Skip to content

Commit 6bf6d62

Browse files
ryanzhang-ossRyan Zhang
andauthored
feat: rename update run state (#348)
* rename updaterun state Signed-off-by: Ryan Zhang <[email protected]> * fix api test Signed-off-by: Ryan Zhang <[email protected]> --------- Signed-off-by: Ryan Zhang <[email protected]> Co-authored-by: Ryan Zhang <[email protected]>
1 parent fbc2483 commit 6bf6d62

File tree

4 files changed

+91
-91
lines changed

4 files changed

+91
-91
lines changed

apis/placement/v1beta1/stageupdate_types.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,27 +154,27 @@ type State string
154154
const (
155155
// StateNotStarted describes user intent to initialize but not execute the update run.
156156
// This is the default state when an update run is created.
157-
StateNotStarted State = "NotStarted"
157+
StateNotStarted State = "Initialize"
158158

159159
// StateStarted describes user intent to execute (or resume execution if paused).
160-
// Users can subsequently set the state to Stopped or Abandoned.
161-
StateStarted State = "Started"
160+
// Users can subsequently set the state to Pause or Abandon.
161+
StateStarted State = "Execute"
162162

163163
// StateStopped describes user intent to pause the update run.
164-
// Users can subsequently set the state to Started or Abandoned.
165-
StateStopped State = "Stopped"
164+
// Users can subsequently set the state to Execute or Abandon.
165+
StateStopped State = "Pause"
166166

167167
// StateAbandoned describes user intent to abandon the update run.
168168
// This is a terminal state; once set, it cannot be changed.
169-
StateAbandoned State = "Abandoned"
169+
StateAbandoned State = "Abandon"
170170
)
171171

172172
// UpdateRunSpec defines the desired rollout strategy and the snapshot indices of the resources to be updated.
173173
// 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 != 'NotStarted' || self.state != 'Stopped'",message="invalid state transition: cannot transition from NotStarted to Stopped"
175-
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Started' || self.state != 'NotStarted'",message="invalid state transition: cannot transition from Started to NotStarted"
176-
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Stopped' || self.state != 'NotStarted'",message="invalid state transition: cannot transition from Stopped to NotStarted"
177-
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.state) || oldSelf.state != 'Abandoned' || self.state == 'Abandoned'",message="invalid state transition: Abandoned is a terminal state and cannot transition to any other state"
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"
178178
type UpdateRunSpec struct {
179179
// PlacementName is the name of placement that this update run is applied to.
180180
// There can be multiple active update runs for each placement, but
@@ -199,13 +199,13 @@ type UpdateRunSpec struct {
199199
StagedUpdateStrategyName string `json:"stagedRolloutStrategyName"`
200200

201201
// State indicates the desired state of the update run.
202-
// NotStarted: The update run is initialized but execution has not started (default).
203-
// Started: The update run should execute or resume execution.
204-
// Stopped: The update run should pause execution.
205-
// Abandoned: The update run should be abandoned and terminated.
202+
// 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.
206206
// +kubebuilder:validation:Optional
207-
// +kubebuilder:default=NotStarted
208-
// +kubebuilder:validation:Enum=NotStarted;Started;Stopped;Abandoned
207+
// +kubebuilder:default=Initialize
208+
// +kubebuilder:validation:Enum=Initialize;Execute;Pause;Abandon
209209
State State `json:"state,omitempty"`
210210
}
211211

config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,40 +1185,40 @@ spec:
11851185
- message: stagedRolloutStrategyName is immutable
11861186
rule: self == oldSelf
11871187
state:
1188-
default: NotStarted
1188+
default: Initialize
11891189
description: |-
11901190
State indicates the desired state of the update run.
1191-
NotStarted: The update run is initialized but execution has not started (default).
1192-
Started: The update run should execute or resume execution.
1193-
Stopped: The update run should pause execution.
1194-
Abandoned: The update run should be abandoned and terminated.
1191+
Initialize: The update run should be initialized but execution should not start (default).
1192+
Execute: The update run should execute or resume execution.
1193+
Pause: The update run should pause execution.
1194+
Abandon: The update run should be abandoned and terminated.
11951195
enum:
1196-
- NotStarted
1197-
- Started
1198-
- Stopped
1199-
- Abandoned
1196+
- Initialize
1197+
- Execute
1198+
- Pause
1199+
- Abandon
12001200
type: string
12011201
required:
12021202
- placementName
12031203
- stagedRolloutStrategyName
12041204
type: object
12051205
x-kubernetes-validations:
1206-
- message: 'invalid state transition: cannot transition from NotStarted
1207-
to Stopped'
1208-
rule: '!has(oldSelf.state) || oldSelf.state != ''NotStarted'' || self.state
1209-
!= ''Stopped'''
1210-
- message: 'invalid state transition: cannot transition from Started to
1211-
NotStarted'
1212-
rule: '!has(oldSelf.state) || oldSelf.state != ''Started'' || self.state
1213-
!= ''NotStarted'''
1214-
- message: 'invalid state transition: cannot transition from Stopped to
1215-
NotStarted'
1216-
rule: '!has(oldSelf.state) || oldSelf.state != ''Stopped'' || self.state
1217-
!= ''NotStarted'''
1218-
- message: 'invalid state transition: Abandoned is a terminal state and
1206+
- message: 'invalid state transition: cannot transition from Initialize
1207+
to Pause'
1208+
rule: '!(has(oldSelf.state) && oldSelf.state == ''Initialize'' && self.state
1209+
== ''Pause'')'
1210+
- message: 'invalid state transition: cannot transition from Execute to
1211+
Initialize'
1212+
rule: '!(has(oldSelf.state) && oldSelf.state == ''Execute'' && self.state
1213+
== ''Initialize'')'
1214+
- message: 'invalid state transition: cannot transition from Pause to
1215+
Initialize'
1216+
rule: '!(has(oldSelf.state) && oldSelf.state == ''Pause'' && self.state
1217+
== ''Initialize'')'
1218+
- message: 'invalid state transition: Abandon is a terminal state and
12191219
cannot transition to any other state'
1220-
rule: '!has(oldSelf.state) || oldSelf.state != ''Abandoned'' || self.state
1221-
== ''Abandoned'''
1220+
rule: '!has(oldSelf.state) || oldSelf.state != ''Abandon'' || self.state
1221+
== ''Abandon'''
12221222
status:
12231223
description: The observed status of ClusterStagedUpdateRun.
12241224
properties:

config/crd/bases/placement.kubernetes-fleet.io_stagedupdateruns.yaml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -105,40 +105,40 @@ spec:
105105
- message: stagedRolloutStrategyName is immutable
106106
rule: self == oldSelf
107107
state:
108-
default: NotStarted
108+
default: Initialize
109109
description: |-
110110
State indicates the desired state of the update run.
111-
NotStarted: The update run is initialized but execution has not started (default).
112-
Started: The update run should execute or resume execution.
113-
Stopped: The update run should pause execution.
114-
Abandoned: The update run should be abandoned and terminated.
111+
Initialize: The update run should be initialized but execution should not start (default).
112+
Execute: The update run should execute or resume execution.
113+
Pause: The update run should pause execution.
114+
Abandon: The update run should be abandoned and terminated.
115115
enum:
116-
- NotStarted
117-
- Started
118-
- Stopped
119-
- Abandoned
116+
- Initialize
117+
- Execute
118+
- Pause
119+
- Abandon
120120
type: string
121121
required:
122122
- placementName
123123
- stagedRolloutStrategyName
124124
type: object
125125
x-kubernetes-validations:
126-
- message: 'invalid state transition: cannot transition from NotStarted
127-
to Stopped'
128-
rule: '!has(oldSelf.state) || oldSelf.state != ''NotStarted'' || self.state
129-
!= ''Stopped'''
130-
- message: 'invalid state transition: cannot transition from Started to
131-
NotStarted'
132-
rule: '!has(oldSelf.state) || oldSelf.state != ''Started'' || self.state
133-
!= ''NotStarted'''
134-
- message: 'invalid state transition: cannot transition from Stopped to
135-
NotStarted'
136-
rule: '!has(oldSelf.state) || oldSelf.state != ''Stopped'' || self.state
137-
!= ''NotStarted'''
138-
- message: 'invalid state transition: Abandoned is a terminal state and
126+
- message: 'invalid state transition: cannot transition from Initialize
127+
to Pause'
128+
rule: '!(has(oldSelf.state) && oldSelf.state == ''Initialize'' && self.state
129+
== ''Pause'')'
130+
- message: 'invalid state transition: cannot transition from Execute to
131+
Initialize'
132+
rule: '!(has(oldSelf.state) && oldSelf.state == ''Execute'' && self.state
133+
== ''Initialize'')'
134+
- message: 'invalid state transition: cannot transition from Pause to
135+
Initialize'
136+
rule: '!(has(oldSelf.state) && oldSelf.state == ''Pause'' && self.state
137+
== ''Initialize'')'
138+
- message: 'invalid state transition: Abandon is a terminal state and
139139
cannot transition to any other state'
140-
rule: '!has(oldSelf.state) || oldSelf.state != ''Abandoned'' || self.state
141-
== ''Abandoned'''
140+
rule: '!has(oldSelf.state) || oldSelf.state != ''Abandon'' || self.state
141+
== ''Abandon'''
142142
status:
143143
description: The observed status of StagedUpdateRun.
144144
properties:

0 commit comments

Comments
 (0)