From 5ed62841343ac3cf706c9e582ac01d7a397faa7c Mon Sep 17 00:00:00 2001 From: youngLiuHY Date: Tue, 23 Jun 2026 17:57:33 +0800 Subject: [PATCH 1/2] feat: rolloutrun status support SkipTolerations --- .../rollout.kusionstack.io_rolloutruns.yaml | 24 +++++++++++++++++++ rollout/v1alpha1/rolloutrun_types.go | 16 +++++++++++++ rollout/v1alpha1/zz_generated.deepcopy.go | 21 ++++++++++++++++ 3 files changed, 61 insertions(+) diff --git a/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml b/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml index 6ceb9d2..5b6dcc8 100644 --- a/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml +++ b/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml @@ -4740,6 +4740,30 @@ spec: type: array type: object type: array + skipToleration: + description: |- + SkipToleration records the accumulated toleration from skipped batches per workload. + When a batch is skipped, the gap between expected and actual replicas for each workload + is accumulated into this field, allowing subsequent batches to tolerate the deficit. + items: + description: WorkloadSkipToleration records the toleration value accumulated from skipped batches for a specific workload. + properties: + cluster: + description: Cluster defines which cluster the workload is in. + type: string + name: + description: Name is the workload name. + type: string + toleration: + description: |- + Toleration is the accumulated toleration value from skipped batches. + It represents how many replicas the workload is allowed to be short of. + format: int32 + type: integer + required: + - toleration + type: object + type: array required: - currentBatchIndex type: object diff --git a/rollout/v1alpha1/rolloutrun_types.go b/rollout/v1alpha1/rolloutrun_types.go index c85aa05..8b46f4e 100644 --- a/rollout/v1alpha1/rolloutrun_types.go +++ b/rollout/v1alpha1/rolloutrun_types.go @@ -151,11 +151,27 @@ type RolloutRunStatus struct { TargetStatuses []RolloutWorkloadStatus `json:"targetStatuses,omitempty"` } +// WorkloadSkipToleration records the toleration value accumulated from skipped batches for a specific workload. +type WorkloadSkipToleration struct { + // Cluster defines which cluster the workload is in. + Cluster string `json:"cluster,omitempty"` + // Name is the workload name. + Name string `json:"name,omitempty"` + // Toleration is the accumulated toleration value from skipped batches. + // It represents how many replicas the workload is allowed to be short of. + Toleration int32 `json:"toleration"` +} + type RolloutRunBatchStatus struct { // RolloutBatchStatus contains status of current batch RolloutBatchStatus `json:",inline"` // Records contains all batches status details. Records []RolloutRunStepStatus `json:"records,omitempty"` + // SkipTolerations records the accumulated toleration from skipped batches per workload. + // When a batch is skipped, the gap between expected and actual replicas for each workload + // is accumulated into this field, allowing subsequent batches to tolerate the deficit. + // +optional + SkipTolerations []WorkloadSkipToleration `json:"skipTolerations,omitempty"` } type RolloutRunPhase string diff --git a/rollout/v1alpha1/zz_generated.deepcopy.go b/rollout/v1alpha1/zz_generated.deepcopy.go index 3645431..ba0eb7d 100644 --- a/rollout/v1alpha1/zz_generated.deepcopy.go +++ b/rollout/v1alpha1/zz_generated.deepcopy.go @@ -1084,6 +1084,11 @@ func (in *RolloutRunBatchStatus) DeepCopyInto(out *RolloutRunBatchStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.SkipTolerations != nil { + in, out := &in.SkipTolerations, &out.SkipTolerations + *out = make([]WorkloadSkipToleration, len(*in)) + copy(*out, *in) + } return } @@ -2353,3 +2358,19 @@ func (in *WorkloadRef) DeepCopy() *WorkloadRef { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadSkipToleration) DeepCopyInto(out *WorkloadSkipToleration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadSkipToleration. +func (in *WorkloadSkipToleration) DeepCopy() *WorkloadSkipToleration { + if in == nil { + return nil + } + out := new(WorkloadSkipToleration) + in.DeepCopyInto(out) + return out +} From a0f16732c2319bf0a63f862c627577d3dec947b3 Mon Sep 17 00:00:00 2001 From: youngLiuHY Date: Fri, 26 Jun 2026 18:44:02 +0800 Subject: [PATCH 2/2] fix: move batch skip tolerations from status to spec --- .../rollout.kusionstack.io_rolloutruns.yaml | 74 ++++++------------- rollout/v1alpha1/rolloutrun_types.go | 11 +-- rollout/v1alpha1/zz_generated.deepcopy.go | 13 +--- 3 files changed, 32 insertions(+), 66 deletions(-) diff --git a/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml b/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml index 5b6dcc8..c32681a 100644 --- a/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml +++ b/config/crd/rollout/rollout.kusionstack.io_rolloutruns.yaml @@ -2264,32 +2264,30 @@ spec: - targets type: object type: array - toleration: - description: Toleration is the toleration policy of the canary strategy - properties: - initialDelaySeconds: - description: Number of seconds after the toleration check has started before the task are initiated. - format: int32 - type: integer - taskFailureThreshold: - anyOf: - - type: integer - - type: string - description: |- - FailureThreshold indicates how many failed pods can be tolerated before marking the rollout task as success - If not set, the default value is 0, which means no failed pods can be tolerated - This is a task level threshold. - x-kubernetes-int-or-string: true - workloadTotalFailureThreshold: - anyOf: - - type: integer - - type: string - description: |- - WorkloadFailureThreshold indicates how many failed pods can be tolerated in all upgraded pods of one workload. - The default value is 0, which means no failed pods can be tolerated. - This is a workload level threshold. - x-kubernetes-int-or-string: true - type: object + skipTolerations: + description: |- + SkipTolerations records the accumulated toleration from skipped batches per workload. + When a batch is skipped, the gap between expected and actual replicas for each workload + is accumulated into this field, allowing subsequent batches to tolerate the deficit. + items: + description: WorkloadSkipToleration records the toleration value accumulated from skipped batches for a specific workload. + properties: + cluster: + description: Cluster defines which cluster the workload is in. + type: string + name: + description: Name is the workload name. + type: string + toleration: + description: |- + Toleration is the accumulated toleration value from skipped batches. + It represents how many replicas the workload is allowed to be short of. + format: int32 + type: integer + required: + - toleration + type: object + type: array type: object canary: description: Canary defines the canary strategy @@ -4740,30 +4738,6 @@ spec: type: array type: object type: array - skipToleration: - description: |- - SkipToleration records the accumulated toleration from skipped batches per workload. - When a batch is skipped, the gap between expected and actual replicas for each workload - is accumulated into this field, allowing subsequent batches to tolerate the deficit. - items: - description: WorkloadSkipToleration records the toleration value accumulated from skipped batches for a specific workload. - properties: - cluster: - description: Cluster defines which cluster the workload is in. - type: string - name: - description: Name is the workload name. - type: string - toleration: - description: |- - Toleration is the accumulated toleration value from skipped batches. - It represents how many replicas the workload is allowed to be short of. - format: int32 - type: integer - required: - - toleration - type: object - type: array required: - currentBatchIndex type: object diff --git a/rollout/v1alpha1/rolloutrun_types.go b/rollout/v1alpha1/rolloutrun_types.go index 8b46f4e..32b7113 100644 --- a/rollout/v1alpha1/rolloutrun_types.go +++ b/rollout/v1alpha1/rolloutrun_types.go @@ -76,9 +76,11 @@ type RolloutRunBatchStrategy struct { // Batches define the order of phases to execute release in batch release Batches []RolloutRunStep `json:"batches,omitempty"` - // Toleration is the toleration policy of the canary strategy + // SkipTolerations records the accumulated toleration from skipped batches per workload. + // When a batch is skipped, the gap between expected and actual replicas for each workload + // is accumulated into this field, allowing subsequent batches to tolerate the deficit. // +optional - Toleration *TolerationStrategy `json:"toleration,omitempty"` + SkipTolerations []WorkloadSkipToleration `json:"skipTolerations,omitempty"` } type RolloutRunStep struct { @@ -167,11 +169,6 @@ type RolloutRunBatchStatus struct { RolloutBatchStatus `json:",inline"` // Records contains all batches status details. Records []RolloutRunStepStatus `json:"records,omitempty"` - // SkipTolerations records the accumulated toleration from skipped batches per workload. - // When a batch is skipped, the gap between expected and actual replicas for each workload - // is accumulated into this field, allowing subsequent batches to tolerate the deficit. - // +optional - SkipTolerations []WorkloadSkipToleration `json:"skipTolerations,omitempty"` } type RolloutRunPhase string diff --git a/rollout/v1alpha1/zz_generated.deepcopy.go b/rollout/v1alpha1/zz_generated.deepcopy.go index ba0eb7d..98ee074 100644 --- a/rollout/v1alpha1/zz_generated.deepcopy.go +++ b/rollout/v1alpha1/zz_generated.deepcopy.go @@ -1084,11 +1084,6 @@ func (in *RolloutRunBatchStatus) DeepCopyInto(out *RolloutRunBatchStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.SkipTolerations != nil { - in, out := &in.SkipTolerations, &out.SkipTolerations - *out = make([]WorkloadSkipToleration, len(*in)) - copy(*out, *in) - } return } @@ -1112,10 +1107,10 @@ func (in *RolloutRunBatchStrategy) DeepCopyInto(out *RolloutRunBatchStrategy) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.Toleration != nil { - in, out := &in.Toleration, &out.Toleration - *out = new(TolerationStrategy) - (*in).DeepCopyInto(*out) + if in.SkipTolerations != nil { + in, out := &in.SkipTolerations, &out.SkipTolerations + *out = make([]WorkloadSkipToleration, len(*in)) + copy(*out, *in) } return }