From af6d56c8d0b5cd2047618ae3e2b9ca3a0bef90b9 Mon Sep 17 00:00:00 2001 From: haoqing0110 Date: Tue, 2 Jan 2024 07:36:13 +0000 Subject: [PATCH] remove timeout field in rolloutstrategy v1alpha1 Signed-off-by: haoqing0110 --- ...gement.io_clustermanagementaddons.crd.yaml | 93 +++++++------------ cluster/v1alpha1/helpers.go | 7 ++ cluster/v1alpha1/types_rolloutstrategy.go | 15 +-- cluster/v1alpha1/zz_generated.deepcopy.go | 6 ++ .../zz_generated.swagger_doc_generated.go | 5 +- ...gement.io_manifestworkreplicasets.crd.yaml | 81 ++++++---------- 6 files changed, 78 insertions(+), 129 deletions(-) diff --git a/addon/v1alpha1/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml b/addon/v1alpha1/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml index 9f2cc65ec..a1ff3a9c2 100644 --- a/addon/v1alpha1/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml +++ b/addon/v1alpha1/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml @@ -155,10 +155,11 @@ spec: default: 0 description: MaxFailures is a percentage or number of clusters in the current rollout that can fail - before proceeding to the next rollout. MaxFailures - is only considered for rollout types Progressive - and ProgressivePerGroup. For Progressive, this - is considered over the total number of clusters. + before proceeding to the next rollout. Once the + MaxFailures is breached, the rollout will stop. + MaxFailures is only considered for rollout types + Progressive and ProgressivePerGroup. For Progressive, + this is considered over the total number of clusters. For ProgressivePerGroup, this is considered according to the size of the current group. For both Progressive and ProgressivePerGroup, the MaxFailures does @@ -185,26 +186,16 @@ spec: default: None description: ProgressDeadline defines how long workload applier controller will wait for the workload - to reach a successful state in the cluster. ProgressDeadline - default value is "None", meaning the workload - applier will wait for a successful state indefinitely. + to reach a successful state in the cluster. If + the workload does not reach a successful state + after ProgressDeadline, will stop waiting and + proceed to next rollout. ProgressDeadline default + value is "None", meaning the workload applier + will wait for a successful state indefinitely. ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s pattern: ^(([0-9])+[h|m|s])|None$ type: string - timeout: - default: None - description: "Timeout defines how long the workload - applier controller will wait until the workload - reaches a successful state in the cluster. Timeout - default value is None meaning the workload applier - will not proceed apply workload to other clusters - if did not reach the successful state. Timeout - must be defined in [0-9h]|[0-9m]|[0-9s] format - examples; 2h , 90m , 360s \n Deprecated: Use ProgressDeadline - instead." - pattern: ^(([0-9])+[h|m|s])|None$ - type: string type: object progressive: description: Progressive defines required fields for @@ -252,10 +243,11 @@ spec: default: 0 description: MaxFailures is a percentage or number of clusters in the current rollout that can fail - before proceeding to the next rollout. MaxFailures - is only considered for rollout types Progressive - and ProgressivePerGroup. For Progressive, this - is considered over the total number of clusters. + before proceeding to the next rollout. Once the + MaxFailures is breached, the rollout will stop. + MaxFailures is only considered for rollout types + Progressive and ProgressivePerGroup. For Progressive, + this is considered over the total number of clusters. For ProgressivePerGroup, this is considered according to the size of the current group. For both Progressive and ProgressivePerGroup, the MaxFailures does @@ -282,26 +274,16 @@ spec: default: None description: ProgressDeadline defines how long workload applier controller will wait for the workload - to reach a successful state in the cluster. ProgressDeadline - default value is "None", meaning the workload - applier will wait for a successful state indefinitely. + to reach a successful state in the cluster. If + the workload does not reach a successful state + after ProgressDeadline, will stop waiting and + proceed to next rollout. ProgressDeadline default + value is "None", meaning the workload applier + will wait for a successful state indefinitely. ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s pattern: ^(([0-9])+[h|m|s])|None$ type: string - timeout: - default: None - description: "Timeout defines how long the workload - applier controller will wait until the workload - reaches a successful state in the cluster. Timeout - default value is None meaning the workload applier - will not proceed apply workload to other clusters - if did not reach the successful state. Timeout - must be defined in [0-9h]|[0-9m]|[0-9s] format - examples; 2h , 90m , 360s \n Deprecated: Use ProgressDeadline - instead." - pattern: ^(([0-9])+[h|m|s])|None$ - type: string type: object progressivePerGroup: description: ProgressivePerGroup defines required fields @@ -338,10 +320,11 @@ spec: default: 0 description: MaxFailures is a percentage or number of clusters in the current rollout that can fail - before proceeding to the next rollout. MaxFailures - is only considered for rollout types Progressive - and ProgressivePerGroup. For Progressive, this - is considered over the total number of clusters. + before proceeding to the next rollout. Once the + MaxFailures is breached, the rollout will stop. + MaxFailures is only considered for rollout types + Progressive and ProgressivePerGroup. For Progressive, + this is considered over the total number of clusters. For ProgressivePerGroup, this is considered according to the size of the current group. For both Progressive and ProgressivePerGroup, the MaxFailures does @@ -368,26 +351,16 @@ spec: default: None description: ProgressDeadline defines how long workload applier controller will wait for the workload - to reach a successful state in the cluster. ProgressDeadline - default value is "None", meaning the workload - applier will wait for a successful state indefinitely. + to reach a successful state in the cluster. If + the workload does not reach a successful state + after ProgressDeadline, will stop waiting and + proceed to next rollout. ProgressDeadline default + value is "None", meaning the workload applier + will wait for a successful state indefinitely. ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s pattern: ^(([0-9])+[h|m|s])|None$ type: string - timeout: - default: None - description: "Timeout defines how long the workload - applier controller will wait until the workload - reaches a successful state in the cluster. Timeout - default value is None meaning the workload applier - will not proceed apply workload to other clusters - if did not reach the successful state. Timeout - must be defined in [0-9h]|[0-9m]|[0-9s] format - examples; 2h , 90m , 360s \n Deprecated: Use ProgressDeadline - instead." - pattern: ^(([0-9])+[h|m|s])|None$ - type: string type: object type: default: All diff --git a/cluster/v1alpha1/helpers.go b/cluster/v1alpha1/helpers.go index 8ee35b153..78b56dabb 100644 --- a/cluster/v1alpha1/helpers.go +++ b/cluster/v1alpha1/helpers.go @@ -293,6 +293,9 @@ func progressivePerCluster( // If there was a breach of MaxFailures, only handle clusters that have already had workload applied if !failureBreach || failureBreach && status.Status != ToApply { + // The length of `rolloutClusters` will be compared with the target rollout size to determine whether to return or not. + // The `timeoutClusters` only records clusters that are timeout and is not used for comparison with the target rollout size. + // In other words, the timeouted clusters are skipped and continue rollout on other clusters. rolloutClusters, timeoutClusters = determineRolloutStatus(&status, minSuccessTime, timeout, rolloutClusters, timeoutClusters) } @@ -314,6 +317,7 @@ func progressivePerCluster( } } + // Return if the maxFailures is breached. if failureBreach { return RolloutResult{ ClustersToRollout: rolloutClusters, @@ -377,6 +381,9 @@ func progressivePerGroup( // ToApply will be reconsidered in the decisionGroups iteration. if status.Status != ToApply { + // The length of `rolloutClusters` will be compared with the target rollout size to determine whether to return or not. + // The `timeoutClusters` only records clusters that are timeout and is not used for comparison with the target rollout size. + // In other words, the timeouted clusters are skipped and continue rollout on other clusters. rolloutClusters, timeoutClusters = determineRolloutStatus(&status, minSuccessTime, timeout, rolloutClusters, timeoutClusters) existingClusters[status.ClusterName] = status.Status } diff --git a/cluster/v1alpha1/types_rolloutstrategy.go b/cluster/v1alpha1/types_rolloutstrategy.go index a887ffc3d..931ce7518 100644 --- a/cluster/v1alpha1/types_rolloutstrategy.go +++ b/cluster/v1alpha1/types_rolloutstrategy.go @@ -64,6 +64,8 @@ type RolloutConfig struct { MinSuccessTime metav1.Duration `json:"minSuccessTime,omitempty"` // ProgressDeadline defines how long workload applier controller will wait for the workload to // reach a successful state in the cluster. + // If the workload does not reach a successful state after ProgressDeadline, will stop waiting + // and proceed to next rollout. // ProgressDeadline default value is "None", meaning the workload applier will wait for a // successful state indefinitely. // ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s @@ -72,7 +74,7 @@ type RolloutConfig struct { // +optional ProgressDeadline string `json:"progressDeadline,omitempty"` // MaxFailures is a percentage or number of clusters in the current rollout that can fail before - // proceeding to the next rollout. + // proceeding to the next rollout. Once the MaxFailures is breached, the rollout will stop. // MaxFailures is only considered for rollout types Progressive and ProgressivePerGroup. For // Progressive, this is considered over the total number of clusters. For ProgressivePerGroup, // this is considered according to the size of the current group. For both Progressive and @@ -84,17 +86,6 @@ type RolloutConfig struct { // +kubebuilder:default=0 // +optional MaxFailures intstr.IntOrString `json:"maxFailures,omitempty"` - // Timeout defines how long the workload applier controller will wait until the workload reaches a - // successful state in the cluster. - // Timeout default value is None meaning the workload applier will not proceed apply workload to - // other clusters if did not reach the successful state. - // Timeout must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s - // - // Deprecated: Use ProgressDeadline instead. - // +kubebuilder:validation:Pattern="^(([0-9])+[h|m|s])|None$" - // +kubebuilder:default:="None" - // +optional - Timeout string `json:"timeout,omitempty"` } // MandatoryDecisionGroup set the decision group name or group index. diff --git a/cluster/v1alpha1/zz_generated.deepcopy.go b/cluster/v1alpha1/zz_generated.deepcopy.go index 5223c00b1..85e494258 100644 --- a/cluster/v1alpha1/zz_generated.deepcopy.go +++ b/cluster/v1alpha1/zz_generated.deepcopy.go @@ -8,6 +8,7 @@ package v1alpha1 import ( "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + timex "time" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -338,6 +339,11 @@ func (in *RolloutResult) DeepCopyInto(out *RolloutResult) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.RecheckAfter != nil { + in, out := &in.RecheckAfter, &out.RecheckAfter + *out = new(timex.Duration) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutResult. diff --git a/cluster/v1alpha1/zz_generated.swagger_doc_generated.go b/cluster/v1alpha1/zz_generated.swagger_doc_generated.go index 79766e058..173662a20 100644 --- a/cluster/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/cluster/v1alpha1/zz_generated.swagger_doc_generated.go @@ -108,9 +108,8 @@ func (RolloutAll) SwaggerDoc() map[string]string { var map_RolloutConfig = map[string]string{ "": "Timeout to consider while applying the workload.", "minSuccessTime": "MinSuccessTime is a \"soak\" time. In other words, the minimum amount of time the workload applier controller will wait from the start of each rollout before proceeding (assuming a successful state has been reached and MaxFailures wasn't breached). MinSuccessTime is only considered for rollout types Progressive and ProgressivePerGroup. The default value is 0 meaning the workload applier proceeds immediately after a successful state is reached. MinSuccessTime must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s", - "progressDeadline": "ProgressDeadline defines how long workload applier controller will wait for the workload to reach a successful state in the cluster. ProgressDeadline default value is \"None\", meaning the workload applier will wait for a successful state indefinitely. ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s", - "maxFailures": "MaxFailures is a percentage or number of clusters in the current rollout that can fail before proceeding to the next rollout. MaxFailures is only considered for rollout types Progressive and ProgressivePerGroup. For Progressive, this is considered over the total number of clusters. For ProgressivePerGroup, this is considered according to the size of the current group. For both Progressive and ProgressivePerGroup, the MaxFailures does not apply for MandatoryDecisionGroups, which tolerate no failures. Default is that no failures are tolerated.", - "timeout": "Timeout defines how long the workload applier controller will wait until the workload reaches a successful state in the cluster. Timeout default value is None meaning the workload applier will not proceed apply workload to other clusters if did not reach the successful state. Timeout must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s\n\nDeprecated: Use ProgressDeadline instead.", + "progressDeadline": "ProgressDeadline defines how long workload applier controller will wait for the workload to reach a successful state in the cluster. If the workload does not reach a successful state after ProgressDeadline, will stop waiting and proceed to next rollout. ProgressDeadline default value is \"None\", meaning the workload applier will wait for a successful state indefinitely. ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s", + "maxFailures": "MaxFailures is a percentage or number of clusters in the current rollout that can fail before proceeding to the next rollout. Once the MaxFailures is breached, the rollout will stop. MaxFailures is only considered for rollout types Progressive and ProgressivePerGroup. For Progressive, this is considered over the total number of clusters. For ProgressivePerGroup, this is considered according to the size of the current group. For both Progressive and ProgressivePerGroup, the MaxFailures does not apply for MandatoryDecisionGroups, which tolerate no failures. Default is that no failures are tolerated.", } func (RolloutConfig) SwaggerDoc() map[string]string { diff --git a/work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml b/work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml index 938832f75..00de9b6b6 100644 --- a/work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml +++ b/work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml @@ -344,11 +344,12 @@ spec: default: 0 description: MaxFailures is a percentage or number of clusters in the current rollout that can fail before - proceeding to the next rollout. MaxFailures is only - considered for rollout types Progressive and ProgressivePerGroup. - For Progressive, this is considered over the total - number of clusters. For ProgressivePerGroup, this - is considered according to the size of the current + proceeding to the next rollout. Once the MaxFailures + is breached, the rollout will stop. MaxFailures is + only considered for rollout types Progressive and + ProgressivePerGroup. For Progressive, this is considered + over the total number of clusters. For ProgressivePerGroup, + this is considered according to the size of the current group. For both Progressive and ProgressivePerGroup, the MaxFailures does not apply for MandatoryDecisionGroups, which tolerate no failures. Default is that no failures @@ -373,25 +374,15 @@ spec: default: None description: ProgressDeadline defines how long workload applier controller will wait for the workload to reach - a successful state in the cluster. ProgressDeadline + a successful state in the cluster. If the workload + does not reach a successful state after ProgressDeadline, + will stop waiting and proceed to next rollout. ProgressDeadline default value is "None", meaning the workload applier will wait for a successful state indefinitely. ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s pattern: ^(([0-9])+[h|m|s])|None$ type: string - timeout: - default: None - description: "Timeout defines how long the workload - applier controller will wait until the workload reaches - a successful state in the cluster. Timeout default - value is None meaning the workload applier will not - proceed apply workload to other clusters if did not - reach the successful state. Timeout must be defined - in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m - , 360s \n Deprecated: Use ProgressDeadline instead." - pattern: ^(([0-9])+[h|m|s])|None$ - type: string type: object progressive: description: Progressive defines required fields for RolloutStrategy @@ -438,11 +429,12 @@ spec: default: 0 description: MaxFailures is a percentage or number of clusters in the current rollout that can fail before - proceeding to the next rollout. MaxFailures is only - considered for rollout types Progressive and ProgressivePerGroup. - For Progressive, this is considered over the total - number of clusters. For ProgressivePerGroup, this - is considered according to the size of the current + proceeding to the next rollout. Once the MaxFailures + is breached, the rollout will stop. MaxFailures is + only considered for rollout types Progressive and + ProgressivePerGroup. For Progressive, this is considered + over the total number of clusters. For ProgressivePerGroup, + this is considered according to the size of the current group. For both Progressive and ProgressivePerGroup, the MaxFailures does not apply for MandatoryDecisionGroups, which tolerate no failures. Default is that no failures @@ -467,25 +459,15 @@ spec: default: None description: ProgressDeadline defines how long workload applier controller will wait for the workload to reach - a successful state in the cluster. ProgressDeadline + a successful state in the cluster. If the workload + does not reach a successful state after ProgressDeadline, + will stop waiting and proceed to next rollout. ProgressDeadline default value is "None", meaning the workload applier will wait for a successful state indefinitely. ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s pattern: ^(([0-9])+[h|m|s])|None$ type: string - timeout: - default: None - description: "Timeout defines how long the workload - applier controller will wait until the workload reaches - a successful state in the cluster. Timeout default - value is None meaning the workload applier will not - proceed apply workload to other clusters if did not - reach the successful state. Timeout must be defined - in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m - , 360s \n Deprecated: Use ProgressDeadline instead." - pattern: ^(([0-9])+[h|m|s])|None$ - type: string type: object progressivePerGroup: description: ProgressivePerGroup defines required fields @@ -522,11 +504,12 @@ spec: default: 0 description: MaxFailures is a percentage or number of clusters in the current rollout that can fail before - proceeding to the next rollout. MaxFailures is only - considered for rollout types Progressive and ProgressivePerGroup. - For Progressive, this is considered over the total - number of clusters. For ProgressivePerGroup, this - is considered according to the size of the current + proceeding to the next rollout. Once the MaxFailures + is breached, the rollout will stop. MaxFailures is + only considered for rollout types Progressive and + ProgressivePerGroup. For Progressive, this is considered + over the total number of clusters. For ProgressivePerGroup, + this is considered according to the size of the current group. For both Progressive and ProgressivePerGroup, the MaxFailures does not apply for MandatoryDecisionGroups, which tolerate no failures. Default is that no failures @@ -551,25 +534,15 @@ spec: default: None description: ProgressDeadline defines how long workload applier controller will wait for the workload to reach - a successful state in the cluster. ProgressDeadline + a successful state in the cluster. If the workload + does not reach a successful state after ProgressDeadline, + will stop waiting and proceed to next rollout. ProgressDeadline default value is "None", meaning the workload applier will wait for a successful state indefinitely. ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s pattern: ^(([0-9])+[h|m|s])|None$ type: string - timeout: - default: None - description: "Timeout defines how long the workload - applier controller will wait until the workload reaches - a successful state in the cluster. Timeout default - value is None meaning the workload applier will not - proceed apply workload to other clusters if did not - reach the successful state. Timeout must be defined - in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m - , 360s \n Deprecated: Use ProgressDeadline instead." - pattern: ^(([0-9])+[h|m|s])|None$ - type: string type: object type: default: All