Skip to content

Commit 32e66fd

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

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
@@ -92,7 +92,7 @@ type UpdateRunObjList interface {
9292
// +kubebuilder:printcolumn:JSONPath=`.spec.resourceSnapshotIndex`,name="Resource-Snapshot-Index",type=string
9393
// +kubebuilder:printcolumn:JSONPath=`.status.policySnapshotIndexUsed`,name="Policy-Snapshot-Index",type=string
9494
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Initialized")].status`,name="Initialized",type=string
95-
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Started")].status`,name="Started",type=string
95+
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Progressing")].status`,name="Progressing",type=string
9696
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Succeeded")].status`,name="Succeeded",type=string
9797
// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date
9898
// +kubebuilder:printcolumn:JSONPath=`.spec.stagedRolloutStrategyName`,name="Strategy",priority=1,type=string
@@ -153,11 +153,18 @@ func (c *ClusterStagedUpdateRun) SetUpdateRunStatus(status UpdateRunStatus) {
153153
type State string
154154

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

159-
// StateStop indicates the update run should be stopped and not executing.
163+
// StateStop indicates the update run should pause execution.
160164
StateStop State = "Stop"
165+
166+
// StateAbandon indicates the update run should be abandoned and terminated.
167+
StateAbandon State = "Abandon"
161168
)
162169

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

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

@@ -387,7 +396,7 @@ type UpdateRunStatus struct {
387396
// +listMapKey=type
388397
//
389398
// Conditions is an array of current observed conditions for StagedUpdateRun.
390-
// Known conditions are "Initialized", "Started", "Progressing", "Succeeded".
399+
// Known conditions are "Initialized", "Progressing", "Succeeded", "Abandoned".
391400
// +kubebuilder:validation:Optional
392401
Conditions []metav1.Condition `json:"conditions,omitempty"`
393402
}
@@ -405,12 +414,6 @@ const (
405414
// - "Unknown": The staged update run initialization has started.
406415
StagedUpdateRunConditionInitialized StagedUpdateRunConditionType = "Initialized"
407416

408-
// StagedUpdateRunConditionStarted indicates whether the staged update run has been started.
409-
// Its condition status can be one of the following:
410-
// - "True": The staged update run has been started and is ready to progress.
411-
// - "False": The staged update run is stopped or not yet started.
412-
StagedUpdateRunConditionStarted StagedUpdateRunConditionType = "Started"
413-
414417
// StagedUpdateRunConditionProgressing indicates whether the staged update run is making progress.
415418
// Its condition status can be one of the following:
416419
// - "True": The staged update run is making progress.
@@ -423,6 +426,11 @@ const (
423426
// - "True": The staged update run is completed successfully.
424427
// - "False": The staged update run encountered an error and stopped.
425428
StagedUpdateRunConditionSucceeded StagedUpdateRunConditionType = "Succeeded"
429+
430+
// StagedUpdateRunConditionAbandoned indicates whether the staged update run has been abandoned.
431+
// Its condition status can be one of the following:
432+
// - "True": The staged update run has been abandoned by user request.
433+
StagedUpdateRunConditionAbandoned StagedUpdateRunConditionType = "Abandoned"
426434
)
427435

428436
// StageUpdatingStatus defines the status of the update run in a stage.
@@ -773,7 +781,7 @@ func (c *ClusterApprovalRequestList) GetApprovalRequestObjs() []ApprovalRequestO
773781
// +kubebuilder:printcolumn:JSONPath=`.spec.resourceSnapshotIndex`,name="Resource-Snapshot-Index",type=string
774782
// +kubebuilder:printcolumn:JSONPath=`.status.policySnapshotIndexUsed`,name="Policy-Snapshot-Index",type=string
775783
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Initialized")].status`,name="Initialized",type=string
776-
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Started")].status`,name="Started",type=string
784+
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Progressing")].status`,name="Progressing",type=string
777785
// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Succeeded")].status`,name="Succeeded",type=string
778786
// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date
779787
// +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)