You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// State represents the desired state of an update run.
151
+
// +enum
152
+
typeStatestring
153
+
154
+
const (
155
+
// StateNotStarted describes user intent to initialize but not execute the update run.
156
+
// This is the default state when an update run is created.
157
+
StateNotStartedState="NotStarted"
158
+
159
+
// StateStarted describes user intent to execute (or resume execution if paused).
160
+
// Users can subsequently set the state to Stopped or Abandoned.
161
+
StateStartedState="Started"
162
+
163
+
// StateStopped describes user intent to pause the update run.
164
+
// Users can subsequently set the state to Started or Abandoned.
165
+
StateStoppedState="Stopped"
166
+
167
+
// StateAbandoned describes user intent to abandon the update run.
168
+
// This is a terminal state; once set, it cannot be changed.
169
+
StateAbandonedState="Abandoned"
170
+
)
171
+
149
172
// UpdateRunSpec defines the desired rollout strategy and the snapshot indices of the resources to be updated.
150
173
// 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"
151
178
typeUpdateRunSpecstruct {
152
179
// PlacementName is the name of placement that this update run is applied to.
153
180
// There can be multiple active update runs for each placement, but
154
181
// it's up to the DevOps team to ensure they don't conflict with each other.
155
182
// +kubebuilder:validation:Required
156
183
// +kubebuilder:validation:MaxLength=255
184
+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="placementName is immutable"
157
185
PlacementNamestring`json:"placementName"`
158
186
159
187
// The resource snapshot index of the selected resources to be updated across clusters.
160
188
// The index represents a group of resource snapshots that includes all the resources a ResourcePlacement selected.
161
189
// +kubebuilder:validation:Required
190
+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="resourceSnapshotIndex is immutable"
// The collection of tasks that each stage needs to complete successfully before moving to the next stage.
279
330
// Each task is executed in parallel and there cannot be more than one task of the same type.
280
331
// +kubebuilder:validation:MaxItems=2
281
332
// +kubebuilder:validation:Optional
282
333
// +kubebuilder:validation:XValidation:rule="!self.exists(e, e.type == 'Approval' && has(e.waitTime))",message="AfterStageTaskType is Approval, waitTime is not allowed"
283
334
// +kubebuilder:validation:XValidation:rule="!self.exists(e, e.type == 'TimedWait' && !has(e.waitTime))",message="AfterStageTaskType is TimedWait, waitTime is required"
// The collection of tasks that needs to completed successfully by each stage before starting the stage.
338
+
// Each task is executed in parallel and there cannot be more than one task of the same type.
339
+
// +kubebuilder:validation:Optional
340
+
// +kubebuilder:validation:MaxItems=1
341
+
// +kubebuilder:validation:XValidation:rule="!self.exists(e, e.type == 'Approval' && has(e.waitTime))",message="AfterStageTaskType is Approval, waitTime is not allowed"
342
+
// +kubebuilder:validation:XValidation:rule="!self.exists(e, e.type == 'TimedWait')",message="BeforeStageTaskType cannot be TimedWait"
0 commit comments