Skip to content

Commit 99cc15d

Browse files
chore: backport 20251208 (#1242)
2 parents 84823d8 + 5730600 commit 99cc15d

File tree

65 files changed

+3575
-890
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3575
-890
lines changed

.github/workflows/chart.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
deploy:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/[email protected].0
21+
- uses: actions/[email protected].1
2222
with:
2323
submodules: true
2424
fetch-depth: 0

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
go-version: ${{ env.GO_VERSION }}
4141

4242
- name: Check out code into the Go module directory
43-
uses: actions/[email protected].0
43+
uses: actions/[email protected].1
4444

4545
- name: Set up Ginkgo CLI
4646
run: |
@@ -90,7 +90,7 @@ jobs:
9090
go-version: ${{ env.GO_VERSION }}
9191

9292
- name: Check out code into the Go module directory
93-
uses: actions/[email protected].0
93+
uses: actions/[email protected].1
9494

9595
- name: Move Docker data directory to /mnt
9696
# The default storage device on GitHub-hosted runners is running low during e2e tests.

.github/workflows/code-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
go-version: ${{ env.GO_VERSION }}
4444

4545
- name: Checkout
46-
uses: actions/[email protected].0
46+
uses: actions/[email protected].1
4747
with:
4848
submodules: true
4949

@@ -64,7 +64,7 @@ jobs:
6464
go-version: ${{ env.GO_VERSION }}
6565

6666
- name: Check out code into the Go module directory
67-
uses: actions/[email protected].0
67+
uses: actions/[email protected].1
6868

6969
- name: golangci-lint
7070
run: make lint

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/[email protected].0
41+
uses: actions/[email protected].1
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL

.github/workflows/codespell.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Harden Runner
15-
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
15+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
1616
with:
1717
egress-policy: audit
1818

19-
- uses: actions/checkout@c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5 # v4.1.7
19+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
2020
- uses: codespell-project/actions-codespell@8f01853be192eb0f849a5c7d721450e7a467c579 # master
2121
with:
2222
check_filenames: true

.github/workflows/markdown-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
markdown-link-check:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/[email protected].0
13+
- uses: actions/[email protected].1
1414
- uses: tcort/github-action-markdown-link-check@v1
1515
with:
1616
# this will only show errors in the output

.github/workflows/trivy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
go-version: ${{ env.GO_VERSION }}
4545

4646
- name: Checkout code
47-
uses: actions/[email protected].0
47+
uses: actions/[email protected].1
4848

4949
- name: Login to ${{ env.REGISTRY }}
5050
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef

.github/workflows/upgrade.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
go-version: ${{ env.GO_VERSION }}
4545

4646
- name: Check out code into the Go module directory
47-
uses: actions/[email protected].0
47+
uses: actions/[email protected].1
4848
with:
4949
# Fetch the history of all branches and tags.
5050
# This is needed for the test suite to switch between releases.
@@ -146,7 +146,7 @@ jobs:
146146
go-version: ${{ env.GO_VERSION }}
147147

148148
- name: Check out code into the Go module directory
149-
uses: actions/[email protected].0
149+
uses: actions/[email protected].1
150150
with:
151151
# Fetch the history of all branches and tags.
152152
# This is needed for the test suite to switch between releases.
@@ -248,7 +248,7 @@ jobs:
248248
go-version: ${{ env.GO_VERSION }}
249249

250250
- name: Check out code into the Go module directory
251-
uses: actions/[email protected].0
251+
uses: actions/[email protected].1
252252
with:
253253
# Fetch the history of all branches and tags.
254254
# This is needed for the test suite to switch between releases.

apis/placement/v1beta1/commons.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ const (
156156
UpdateRunFinalizer = FleetPrefix + "stagedupdaterun-finalizer"
157157

158158
// TargetUpdateRunLabel indicates the target update run on a staged run related object.
159-
TargetUpdateRunLabel = FleetPrefix + "targetupdaterun"
159+
TargetUpdateRunLabel = FleetPrefix + "targetUpdateRun"
160+
161+
// TaskTypeLabel indicates the task type (before-stage or after-stage) on a staged run related object.
162+
TaskTypeLabel = FleetPrefix + "taskType"
160163

161164
// UpdateRunDeleteStageName is the name of delete stage in the staged update run.
162165
UpdateRunDeleteStageName = FleetPrefix + "deleteStage"
@@ -167,8 +170,17 @@ const (
167170
// TargetUpdatingStageNameLabel indicates the updating stage name on a staged run related object.
168171
TargetUpdatingStageNameLabel = FleetPrefix + "targetUpdatingStage"
169172

170-
// ApprovalTaskNameFmt is the format of the approval task name.
171-
ApprovalTaskNameFmt = "%s-%s"
173+
// BeforeStageTaskLabelValue is the before stage task label value.
174+
BeforeStageTaskLabelValue = "beforeStage"
175+
176+
// AfterStageTaskLabelValue is the after stage task label value.
177+
AfterStageTaskLabelValue = "afterStage"
178+
179+
// BeforeStageApprovalTaskNameFmt is the format of the before stage approval task name.
180+
BeforeStageApprovalTaskNameFmt = "%s-before-%s"
181+
182+
// AfterStageApprovalTaskNameFmt is the format of the after stage approval task name.
183+
AfterStageApprovalTaskNameFmt = "%s-after-%s"
172184
)
173185

174186
var (

apis/placement/v1beta1/stageupdate_types.go

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -152,29 +152,25 @@ func (c *ClusterStagedUpdateRun) SetUpdateRunStatus(status UpdateRunStatus) {
152152
type State string
153153

154154
const (
155-
// StateNotStarted describes user intent to initialize but not execute the update run.
155+
// StateInitialize describes user intent to initialize but not run the update run.
156156
// This is the default state when an update run is created.
157-
StateNotStarted State = "Initialize"
157+
// Users can subsequently set the state to Run.
158+
StateInitialize State = "Initialize"
158159

159-
// StateStarted describes user intent to execute (or resume execution if paused).
160-
// Users can subsequently set the state to Pause or Abandon.
161-
StateStarted State = "Execute"
160+
// StateRun describes user intent to execute (or resume execution if stopped).
161+
// Users can subsequently set the state to Stop.
162+
StateRun State = "Run"
162163

163-
// StateStopped describes user intent to pause the update run.
164-
// Users can subsequently set the state to Execute or Abandon.
165-
StateStopped State = "Pause"
166-
167-
// StateAbandoned describes user intent to abandon the update run.
168-
// This is a terminal state; once set, it cannot be changed.
169-
StateAbandoned State = "Abandon"
164+
// StateStop describes user intent to stop the update run.
165+
// Users can subsequently set the state to Run.
166+
StateStop State = "Stop"
170167
)
171168

172169
// UpdateRunSpec defines the desired rollout strategy and the snapshot indices of the resources to be updated.
173170
// It specifies a stage-by-stage update process across selected clusters for the given ResourcePlacement object.
174-
// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Initialize' && self.state == 'Pause')",message="invalid state transition: cannot transition from Initialize to Pause"
175-
// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Execute' && self.state == 'Initialize')",message="invalid state transition: cannot transition from Execute to Initialize"
176-
// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Pause' && self.state == 'Initialize')",message="invalid state transition: cannot transition from Pause to Initialize"
177-
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Abandon' || self.state == 'Abandon'",message="invalid state transition: Abandon is a terminal state and cannot transition to any other state"
171+
// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Initialize' && self.state == 'Stop')",message="invalid state transition: cannot transition from Initialize to Stop"
172+
// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Run' && self.state == 'Initialize')",message="invalid state transition: cannot transition from Run to Initialize"
173+
// +kubebuilder:validation:XValidation:rule="!(has(oldSelf.state) && oldSelf.state == 'Stop' && self.state == 'Initialize')",message="invalid state transition: cannot transition from Stop to Initialize"
178174
type UpdateRunSpec struct {
179175
// PlacementName is the name of placement that this update run is applied to.
180176
// There can be multiple active update runs for each placement, but
@@ -200,12 +196,11 @@ type UpdateRunSpec struct {
200196

201197
// State indicates the desired state of the update run.
202198
// Initialize: The update run should be initialized but execution should not start (default).
203-
// Execute: The update run should execute or resume execution.
204-
// Pause: The update run should pause execution.
205-
// Abandon: The update run should be abandoned and terminated.
199+
// Run: The update run should execute or resume execution.
200+
// Stop: The update run should stop execution.
206201
// +kubebuilder:validation:Optional
207202
// +kubebuilder:default=Initialize
208-
// +kubebuilder:validation:Enum=Initialize;Execute;Pause;Abandon
203+
// +kubebuilder:validation:Enum=Initialize;Run;Stop
209204
State State `json:"state,omitempty"`
210205
}
211206

@@ -426,7 +421,6 @@ const (
426421
// Its condition status can be one of the following:
427422
// - "True": The staged update run is initialized successfully.
428423
// - "False": The staged update run encountered an error during initialization and aborted.
429-
// - "Unknown": The staged update run initialization has started.
430424
StagedUpdateRunConditionInitialized StagedUpdateRunConditionType = "Initialized"
431425

432426
// StagedUpdateRunConditionProgressing indicates whether the staged update run is making progress.
@@ -679,6 +673,7 @@ type ApprovalRequestObjList interface {
679673
// - `TargetUpdateRun`: Points to the cluster staged update run that this approval request is for.
680674
// - `TargetStage`: The name of the stage that this approval request is for.
681675
// - `IsLatestUpdateRunApproval`: Indicates whether this approval request is the latest one related to this update run.
676+
// - `TaskType`: Indicates whether this approval request is for the before or after stage task.
682677
type ClusterApprovalRequest struct {
683678
metav1.TypeMeta `json:",inline"`
684679
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -925,6 +920,7 @@ func (s *StagedUpdateStrategyList) GetUpdateStrategyObjs() []UpdateStrategyObj {
925920
// - `TargetUpdateRun`: Points to the staged update run that this approval request is for.
926921
// - `TargetStage`: The name of the stage that this approval request is for.
927922
// - `IsLatestUpdateRunApproval`: Indicates whether this approval request is the latest one related to this update run.
923+
// - `TaskType`: Indicates whether this approval request is for the before or after stage task.
928924
type ApprovalRequest struct {
929925
metav1.TypeMeta `json:",inline"`
930926
metav1.ObjectMeta `json:"metadata,omitempty"`

0 commit comments

Comments
 (0)