Skip to content

Commit 0010008

Browse files
author
Arvind Thirumurugan
committed
update API
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
1 parent ed185de commit 0010008

File tree

3 files changed

+43
-27
lines changed

3 files changed

+43
-27
lines changed

apis/placement/v1beta1/stageupdate_types.go

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ type UpdateRunObjList interface {
9191
// +kubebuilder:printcolumn:JSONPath=`.spec.resourceSnapshotIndex`,name="Resource-Snapshot-Index",type=string
9292
// +kubebuilder:printcolumn:JSONPath=`.status.policySnapshotIndexUsed`,name="Policy-Snapshot-Index",type=string
9393
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Initialized")].status`,name="Initialized",type=string
94-
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Started")].status`,name="Started",type=string
94+
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Progressing")].status`,name="Progressing",type=string
9595
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Succeeded")].status`,name="Succeeded",type=string
9696
// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date
9797
// +kubebuilder:printcolumn:JSONPath=`.spec.stagedRolloutStrategyName`,name="Strategy",priority=1,type=string
@@ -152,11 +152,18 @@ func (c *ClusterStagedUpdateRun) SetUpdateRunStatus(status UpdateRunStatus) {
152152
type State string
153153

154154
const (
155-
// StateStart indicates the update run should be started and actively executing.
155+
// StateNotStarted indicates the update run has been initialized but execution has not started.
156+
// This is the default state after initialization completes.
157+
StateNotStarted State = "NotStarted"
158+
159+
// StateStart indicates the update run should execute (or resume execution if paused).
156160
StateStart State = "Start"
157161

158-
// StateStop indicates the update run should be stopped and not executing.
162+
// StateStop indicates the update run should pause execution.
159163
StateStop State = "Stop"
164+
165+
// StateAbandon indicates the update run should be abandoned and terminated.
166+
StateAbandon State = "Abandon"
160167
)
161168

162169
// UpdateRunSpec defines the desired rollout strategy and the snapshot indices of the resources to be updated.
@@ -182,11 +189,13 @@ type UpdateRunSpec struct {
182189
StagedUpdateStrategyName string `json:"stagedRolloutStrategyName"`
183190

184191
// State indicates the desired state of the update run.
185-
// When "Stop", the update run will initialize but not execute.
186-
// When "Start", the update run will begin or continue execution.
192+
// NotStarted: The update run is initialized but execution has not started (default).
193+
// Start: The update run should execute or resume execution.
194+
// Stop: The update run should pause execution.
195+
// Abandon: The update run should be abandoned and terminated.
187196
// +kubebuilder:validation:Optional
188-
// +kubebuilder:validation:Enum=Start;Stop
189-
// +kubebuilder:default=Stop
197+
// +kubebuilder:validation:Enum=NotStarted;Start;Stop;Abandon
198+
// +kubebuilder:default=NotStarted
190199
State State `json:"state"`
191200
}
192201

@@ -367,7 +376,7 @@ type UpdateRunStatus struct {
367376
// +listMapKey=type
368377
//
369378
// Conditions is an array of current observed conditions for StagedUpdateRun.
370-
// Known conditions are "Initialized", "Started", "Progressing", "Succeeded".
379+
// Known conditions are "Initialized", "Progressing", "Succeeded", "Abandoned".
371380
// +kubebuilder:validation:Optional
372381
Conditions []metav1.Condition `json:"conditions,omitempty"`
373382
}
@@ -385,12 +394,6 @@ const (
385394
// - "Unknown": The staged update run initialization has started.
386395
StagedUpdateRunConditionInitialized StagedUpdateRunConditionType = "Initialized"
387396

388-
// StagedUpdateRunConditionStarted indicates whether the staged update run has been started.
389-
// Its condition status can be one of the following:
390-
// - "True": The staged update run has been started and is ready to progress.
391-
// - "False": The staged update run is stopped or not yet started.
392-
StagedUpdateRunConditionStarted StagedUpdateRunConditionType = "Started"
393-
394397
// StagedUpdateRunConditionProgressing indicates whether the staged update run is making progress.
395398
// Its condition status can be one of the following:
396399
// - "True": The staged update run is making progress.
@@ -403,6 +406,11 @@ const (
403406
// - "True": The staged update run is completed successfully.
404407
// - "False": The staged update run encountered an error and stopped.
405408
StagedUpdateRunConditionSucceeded StagedUpdateRunConditionType = "Succeeded"
409+
410+
// StagedUpdateRunConditionAbandoned indicates whether the staged update run has been abandoned.
411+
// Its condition status can be one of the following:
412+
// - "True": The staged update run has been abandoned by user request.
413+
StagedUpdateRunConditionAbandoned StagedUpdateRunConditionType = "Abandoned"
406414
)
407415

408416
// StageUpdatingStatus defines the status of the update run in a stage.
@@ -748,7 +756,7 @@ func (c *ClusterApprovalRequestList) GetApprovalRequestObjs() []ApprovalRequestO
748756
// +kubebuilder:printcolumn:JSONPath=`.spec.resourceSnapshotIndex`,name="Resource-Snapshot-Index",type=string
749757
// +kubebuilder:printcolumn:JSONPath=`.status.policySnapshotIndexUsed`,name="Policy-Snapshot-Index",type=string
750758
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Initialized")].status`,name="Initialized",type=string
751-
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Started")].status`,name="Started",type=string
759+
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Progressing")].status`,name="Progressing",type=string
752760
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Succeeded")].status`,name="Succeeded",type=string
753761
// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date
754762
// +kubebuilder:printcolumn:JSONPath=`.spec.stagedRolloutStrategyName`,name="Strategy",priority=1,type=string

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,8 @@ spec:
11121112
- jsonPath: .status.conditions[?(@.type=="Initialized")].status
11131113
name: Initialized
11141114
type: string
1115-
- jsonPath: .status.conditions[?(@.type=="Started")].status
1116-
name: Started
1115+
- jsonPath: .status.conditions[?(@.type=="Progressing")].status
1116+
name: Progressing
11171117
type: string
11181118
- jsonPath: .status.conditions[?(@.type=="Succeeded")].status
11191119
name: Succeeded
@@ -1177,14 +1177,18 @@ spec:
11771177
and recorded in the status field.
11781178
type: string
11791179
state:
1180-
default: Stop
1180+
default: NotStarted
11811181
description: |-
11821182
State indicates the desired state of the update run.
1183-
When "Stop", the update run will initialize but not execute.
1184-
When "Start", the update run will begin or continue execution.
1183+
NotStarted: The update run is initialized but execution has not started (default).
1184+
Start: The update run should execute or resume execution.
1185+
Stop: The update run should pause execution.
1186+
Abandon: The update run should be abandoned and terminated.
11851187
enum:
1188+
- NotStarted
11861189
- Start
11871190
- Stop
1191+
- Abandon
11881192
type: string
11891193
required:
11901194
- placementName
@@ -1429,7 +1433,7 @@ spec:
14291433
conditions:
14301434
description: |-
14311435
Conditions is an array of current observed conditions for StagedUpdateRun.
1432-
Known conditions are "Initialized", "Started", "Progressing", "Succeeded".
1436+
Known conditions are "Initialized", "Progressing", "Succeeded", "Abandoned".
14331437
items:
14341438
description: Condition contains details for one aspect of the current
14351439
state of this API Resource.

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ spec:
3232
- jsonPath: .status.conditions[?(@.type=="Initialized")].status
3333
name: Initialized
3434
type: string
35-
- jsonPath: .status.conditions[?(@.type=="Started")].status
36-
name: Started
35+
- jsonPath: .status.conditions[?(@.type=="Progressing")].status
36+
name: Progressing
3737
type: string
3838
- jsonPath: .status.conditions[?(@.type=="Succeeded")].status
3939
name: Succeeded
@@ -96,14 +96,18 @@ spec:
9696
and recorded in the status field.
9797
type: string
9898
state:
99-
default: Stop
99+
default: NotStarted
100100
description: |-
101101
State indicates the desired state of the update run.
102-
When "Stop", the update run will initialize but not execute.
103-
When "Start", the update run will begin or continue execution.
102+
NotStarted: The update run is initialized but execution has not started (default).
103+
Start: The update run should execute or resume execution.
104+
Stop: The update run should pause execution.
105+
Abandon: The update run should be abandoned and terminated.
104106
enum:
107+
- NotStarted
105108
- Start
106109
- Stop
110+
- Abandon
107111
type: string
108112
required:
109113
- placementName
@@ -348,7 +352,7 @@ spec:
348352
conditions:
349353
description: |-
350354
Conditions is an array of current observed conditions for StagedUpdateRun.
351-
Known conditions are "Initialized", "Started", "Progressing", "Succeeded".
355+
Known conditions are "Initialized", "Progressing", "Succeeded", "Abandoned".
352356
items:
353357
description: Condition contains details for one aspect of the current
354358
state of this API Resource.

0 commit comments

Comments
 (0)