diff --git a/cluster/v1alpha1/helpers.go b/cluster/v1alpha1/helpers.go index d70865825..9280311f6 100644 --- a/cluster/v1alpha1/helpers.go +++ b/cluster/v1alpha1/helpers.go @@ -105,7 +105,7 @@ func (r *RolloutHandler) getRolloutAllClusters(rolloutStrategy RolloutStrategy, } // Parse timeout for the rollout - failureTimeout, err := parseTimeout(strategy.All.Timeout.Timeout) + failureTimeout, err := parseTimeout(strategy.All.ProgressDeadline) if err != nil { return &strategy, RolloutResult{}, err } @@ -137,7 +137,7 @@ func (r *RolloutHandler) getProgressiveClusters(rolloutStrategy RolloutStrategy, } // Parse timeout for non-mandatory decision groups - failureTimeout, err := parseTimeout(strategy.Progressive.Timeout.Timeout) + failureTimeout, err := parseTimeout(strategy.Progressive.ProgressDeadline) if err != nil { return &strategy, RolloutResult{}, err } @@ -176,7 +176,7 @@ func (r *RolloutHandler) getProgressivePerGroupClusters(rolloutStrategy RolloutS } // Parse timeout for non-mandatory decision groups - failureTimeout, err := parseTimeout(strategy.ProgressivePerGroup.Timeout.Timeout) + failureTimeout, err := parseTimeout(strategy.ProgressivePerGroup.ProgressDeadline) if err != nil { return &strategy, RolloutResult{}, err } @@ -189,7 +189,9 @@ func (r *RolloutHandler) getProgressivePerGroupClusters(rolloutStrategy RolloutS return &strategy, rolloutResult, nil } -func progressivePerCluster(clusterGroupsMap clusterv1beta1.ClusterGroupsMap, length int, timeout time.Duration, statusFunc ClusterRolloutStatusFunc) RolloutResult { +func progressivePerCluster( + clusterGroupsMap clusterv1beta1.ClusterGroupsMap, length int, timeout time.Duration, statusFunc ClusterRolloutStatusFunc, +) RolloutResult { rolloutClusters := map[string]ClusterRolloutStatus{} timeoutClusters := map[string]ClusterRolloutStatus{} @@ -289,9 +291,7 @@ func progressivePerGroup(clusterGroupsMap clusterv1beta1.ClusterGroupsMap, timeo func determineRolloutStatusAndContinue(status ClusterRolloutStatus, timeout time.Duration) (*ClusterRolloutStatus, bool) { newStatus := status.DeepCopy() switch status.Status { - case ToApply: - return newStatus, true - case TimeOut, Succeeded, Skip: + case Succeeded, TimeOut, Skip: return newStatus, false case Progressing, Failed: timeOutTime := getTimeOutTime(status.LastTransitionTime, timeout) diff --git a/cluster/v1alpha1/helpers_test.go b/cluster/v1alpha1/helpers_test.go index badcb6b28..e64960dce 100644 --- a/cluster/v1alpha1/helpers_test.go +++ b/cluster/v1alpha1/helpers_test.go @@ -44,7 +44,7 @@ func TestGetRolloutCluster_All(t *testing.T) { }{ { name: "test rollout all with timeout 90s", - rolloutStrategy: RolloutStrategy{Type: All, All: &RolloutAll{Timeout: Timeout{"90s"}}}, + rolloutStrategy: RolloutStrategy{Type: All, All: &RolloutAll{RolloutConfig: RolloutConfig{ProgressDeadline: "90s"}}}, existingScheduledClusterGroups: map[clusterv1beta1.GroupKey]sets.Set[string]{ {GroupName: "group1", GroupIndex: 0}: sets.New[string]("cluster1", "cluster2"), {GroupName: "", GroupIndex: 1}: sets.New[string]("cluster3", "cluster4", "cluster5", "cluster6"), @@ -60,7 +60,7 @@ func TestGetRolloutCluster_All(t *testing.T) { } return clustersRolloutStatus[clusterName] }, - expectRolloutStrategy: &RolloutStrategy{Type: All, All: &RolloutAll{Timeout: Timeout{"90s"}}}, + expectRolloutStrategy: &RolloutStrategy{Type: All, All: &RolloutAll{RolloutConfig: RolloutConfig{ProgressDeadline: "90s"}}}, expectRolloutClusters: map[string]ClusterRolloutStatus{ "cluster1": {GroupKey: clusterv1beta1.GroupKey{GroupName: "group1", GroupIndex: 0}, Status: ToApply, LastTransitionTime: &fakeTime_60s}, "cluster2": {GroupKey: clusterv1beta1.GroupKey{GroupName: "group1", GroupIndex: 0}, Status: Progressing, LastTransitionTime: &fakeTime_60s, TimeOutTime: &fakeTime30s}, @@ -88,7 +88,7 @@ func TestGetRolloutCluster_All(t *testing.T) { } return clustersRolloutStatus[clusterName] }, - expectRolloutStrategy: &RolloutStrategy{Type: All, All: &RolloutAll{Timeout: Timeout{""}}}, + expectRolloutStrategy: &RolloutStrategy{Type: All, All: &RolloutAll{RolloutConfig: RolloutConfig{ProgressDeadline: ""}}}, expectRolloutClusters: map[string]ClusterRolloutStatus{ "cluster1": {GroupKey: clusterv1beta1.GroupKey{GroupName: "group1", GroupIndex: 0}, Status: ToApply}, "cluster2": {GroupKey: clusterv1beta1.GroupKey{GroupName: "group1", GroupIndex: 0}, Status: Progressing, TimeOutTime: &fakeTimeMax}, @@ -99,7 +99,7 @@ func TestGetRolloutCluster_All(t *testing.T) { }, { name: "test rollout all with timeout 0s", - rolloutStrategy: RolloutStrategy{Type: All, All: &RolloutAll{Timeout: Timeout{"0s"}}}, + rolloutStrategy: RolloutStrategy{Type: All, All: &RolloutAll{RolloutConfig: RolloutConfig{ProgressDeadline: "0s"}}}, existingScheduledClusterGroups: map[clusterv1beta1.GroupKey]sets.Set[string]{ {GroupName: "group1", GroupIndex: 0}: sets.New[string]("cluster1", "cluster2"), {GroupName: "", GroupIndex: 1}: sets.New[string]("cluster3", "cluster4", "cluster5"), @@ -114,7 +114,7 @@ func TestGetRolloutCluster_All(t *testing.T) { } return clustersRolloutStatus[clusterName] }, - expectRolloutStrategy: &RolloutStrategy{Type: All, All: &RolloutAll{Timeout: Timeout{"0s"}}}, + expectRolloutStrategy: &RolloutStrategy{Type: All, All: &RolloutAll{RolloutConfig: RolloutConfig{ProgressDeadline: "0s"}}}, expectRolloutClusters: map[string]ClusterRolloutStatus{ "cluster1": {GroupKey: clusterv1beta1.GroupKey{GroupName: "group1", GroupIndex: 0}, Status: ToApply}, "cluster5": {GroupKey: clusterv1beta1.GroupKey{GroupName: "", GroupIndex: 1}}, @@ -165,7 +165,7 @@ func TestGetRolloutCluster_Progressive(t *testing.T) { rolloutStrategy: RolloutStrategy{ Type: Progressive, Progressive: &RolloutProgressive{ - Timeout: Timeout{"90s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "90s"}, }, }, existingScheduledClusterGroups: map[clusterv1beta1.GroupKey]sets.Set[string]{ @@ -186,7 +186,7 @@ func TestGetRolloutCluster_Progressive(t *testing.T) { expectRolloutStrategy: &RolloutStrategy{ Type: Progressive, Progressive: &RolloutProgressive{ - Timeout: Timeout{"90s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "90s"}, }, }, expectRolloutClusters: map[string]ClusterRolloutStatus{ @@ -204,7 +204,7 @@ func TestGetRolloutCluster_Progressive(t *testing.T) { rolloutStrategy: RolloutStrategy{ Type: Progressive, Progressive: &RolloutProgressive{ - Timeout: Timeout{""}, + RolloutConfig: RolloutConfig{ProgressDeadline: ""}, MaxConcurrency: intstr.FromString("50%"), // 50% of total clusters }, }, @@ -225,7 +225,7 @@ func TestGetRolloutCluster_Progressive(t *testing.T) { expectRolloutStrategy: &RolloutStrategy{ Type: Progressive, Progressive: &RolloutProgressive{ - Timeout: Timeout{""}, + RolloutConfig: RolloutConfig{ProgressDeadline: ""}, MaxConcurrency: intstr.FromString("50%"), // 50% of total clusters }, }, @@ -241,7 +241,7 @@ func TestGetRolloutCluster_Progressive(t *testing.T) { rolloutStrategy: RolloutStrategy{ Type: Progressive, Progressive: &RolloutProgressive{ - Timeout: Timeout{"0s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "0s"}, MaxConcurrency: intstr.FromInt(3), // Maximum 3 clusters concurrently }, }, @@ -262,7 +262,7 @@ func TestGetRolloutCluster_Progressive(t *testing.T) { expectRolloutStrategy: &RolloutStrategy{ Type: Progressive, Progressive: &RolloutProgressive{ - Timeout: Timeout{"0s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "0s"}, MaxConcurrency: intstr.FromInt(3), // Maximum 3 clusters concurrently }, }, @@ -311,7 +311,7 @@ func TestGetRolloutCluster_Progressive(t *testing.T) { }, }, MaxConcurrency: intstr.FromString("50%"), - Timeout: Timeout{""}, + RolloutConfig: RolloutConfig{ProgressDeadline: ""}, }, }, expectRolloutClusters: map[string]ClusterRolloutStatus{ @@ -357,7 +357,7 @@ func TestGetRolloutCluster_Progressive(t *testing.T) { }, }, MaxConcurrency: intstr.FromInt(2), - Timeout: Timeout{""}, + RolloutConfig: RolloutConfig{ProgressDeadline: ""}, }, }, expectRolloutClusters: map[string]ClusterRolloutStatus{ @@ -377,7 +377,7 @@ func TestGetRolloutCluster_Progressive(t *testing.T) { }, }, MaxConcurrency: intstr.FromString("50%"), // 50% of total clusters - Timeout: Timeout{"0s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "0s"}, }, }, existingScheduledClusterGroups: map[clusterv1beta1.GroupKey]sets.Set[string]{ @@ -403,7 +403,7 @@ func TestGetRolloutCluster_Progressive(t *testing.T) { }, }, MaxConcurrency: intstr.FromString("50%"), // 50% of total clusters - Timeout: Timeout{"0s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "0s"}, }, }, expectRolloutClusters: map[string]ClusterRolloutStatus{ @@ -455,7 +455,7 @@ func TestGetRolloutCluster_ProgressivePerGroup(t *testing.T) { rolloutStrategy: RolloutStrategy{ Type: ProgressivePerGroup, ProgressivePerGroup: &RolloutProgressivePerGroup{ - Timeout: Timeout{"90s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "90s"}, }, }, existingScheduledClusterGroups: map[clusterv1beta1.GroupKey]sets.Set[string]{ @@ -476,7 +476,7 @@ func TestGetRolloutCluster_ProgressivePerGroup(t *testing.T) { expectRolloutStrategy: &RolloutStrategy{ Type: ProgressivePerGroup, ProgressivePerGroup: &RolloutProgressivePerGroup{ - Timeout: Timeout{"90s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "90s"}, }, }, expectRolloutClusters: map[string]ClusterRolloutStatus{ @@ -509,7 +509,7 @@ func TestGetRolloutCluster_ProgressivePerGroup(t *testing.T) { expectRolloutStrategy: &RolloutStrategy{ Type: ProgressivePerGroup, ProgressivePerGroup: &RolloutProgressivePerGroup{ - Timeout: Timeout{""}, + RolloutConfig: RolloutConfig{ProgressDeadline: ""}, }, }, expectRolloutClusters: map[string]ClusterRolloutStatus{ @@ -523,7 +523,7 @@ func TestGetRolloutCluster_ProgressivePerGroup(t *testing.T) { rolloutStrategy: RolloutStrategy{ Type: ProgressivePerGroup, ProgressivePerGroup: &RolloutProgressivePerGroup{ - Timeout: Timeout{"0s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "0s"}, }, }, existingScheduledClusterGroups: map[clusterv1beta1.GroupKey]sets.Set[string]{ @@ -544,7 +544,7 @@ func TestGetRolloutCluster_ProgressivePerGroup(t *testing.T) { expectRolloutStrategy: &RolloutStrategy{ Type: ProgressivePerGroup, ProgressivePerGroup: &RolloutProgressivePerGroup{ - Timeout: Timeout{"0s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "0s"}, }, }, expectRolloutClusters: map[string]ClusterRolloutStatus{ @@ -652,7 +652,7 @@ func TestGetRolloutCluster_ProgressivePerGroup(t *testing.T) { {GroupName: "group1"}, }, }, - Timeout: Timeout{"0s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "0s"}, }, }, existingScheduledClusterGroups: map[clusterv1beta1.GroupKey]sets.Set[string]{ @@ -677,7 +677,7 @@ func TestGetRolloutCluster_ProgressivePerGroup(t *testing.T) { {GroupName: "group1"}, }, }, - Timeout: Timeout{"0s"}, + RolloutConfig: RolloutConfig{ProgressDeadline: "0s"}, }, }, expectRolloutClusters: map[string]ClusterRolloutStatus{ diff --git a/cluster/v1alpha1/types_rolloutstrategy.go b/cluster/v1alpha1/types_rolloutstrategy.go index c9fa38155..42fd68bf3 100644 --- a/cluster/v1alpha1/types_rolloutstrategy.go +++ b/cluster/v1alpha1/types_rolloutstrategy.go @@ -1,6 +1,7 @@ package v1alpha1 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -8,48 +9,72 @@ import ( // RolloutStrategy API used by workload applier APIs to define how the workload will be applied to the selected clusters by the Placement and DecisionStrategy. +type RolloutType string + const ( //All means apply the workload to all clusters in the decision groups at once. - All string = "All" + All RolloutType = "All" //Progressive means apply the workload to the selected clusters progressively per cluster. - Progressive string = "Progressive" + Progressive RolloutType = "Progressive" //ProgressivePerGroup means apply the workload to the selected clusters progressively per group. - ProgressivePerGroup string = "ProgressivePerGroup" + ProgressivePerGroup RolloutType = "ProgressivePerGroup" ) // Rollout strategy to apply workload to the selected clusters by Placement and DecisionStrategy. type RolloutStrategy struct { // Rollout strategy Types are All, Progressive and ProgressivePerGroup // 1) All means apply the workload to all clusters in the decision groups at once. - // 2) Progressive means apply the workload to the selected clusters progressively per cluster. The workload will not be applied to the next cluster unless one of the current applied clusters reach the successful state or timeout. - // 3) ProgressivePerGroup means apply the workload to decisionGroup clusters progressively per group. The workload will not be applied to the next decisionGroup unless all clusters in the current group reach the successful state or timeout. + // 2) Progressive means apply the workload to the selected clusters progressively per cluster. The workload will not + // be applied to the next cluster unless one of the current applied clusters reach the successful state and haven't + // breached the MaxFailures configuration. + // 3) ProgressivePerGroup means apply the workload to decisionGroup clusters progressively per group. The workload + // will not be applied to the next decisionGroup unless all clusters in the current group reach the successful + // state and haven't breached the MaxFailures configuration. // +kubebuilder:validation:Enum=All;Progressive;ProgressivePerGroup // +kubebuilder:default:=All // +optional - Type string `json:"type,omitempty"` + Type RolloutType `json:"type,omitempty"` - // All define required fields for RolloutStrategy type All + // All defines required fields for RolloutStrategy type All // +optional All *RolloutAll `json:"all,omitempty"` - // Progressive define required fields for RolloutStrategy type Progressive + // Progressive defines required fields for RolloutStrategy type Progressive // +optional Progressive *RolloutProgressive `json:"progressive,omitempty"` - // ProgressivePerGroup define required fields for RolloutStrategy type ProgressivePerGroup + // ProgressivePerGroup defines required fields for RolloutStrategy type ProgressivePerGroup // +optional ProgressivePerGroup *RolloutProgressivePerGroup `json:"progressivePerGroup,omitempty"` } -// Timeout to consider while applying the workload. -type Timeout struct { - // Timeout define how long workload applier controller will wait till workload reach 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 +// RolloutConfig contains common configurations for the rollout strategies. +type RolloutConfig struct { + // 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 proceed immediately after a successful state is reached. + // MinSuccessTime must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s + // +kubebuilder:default:=0 + // +optional + MinSuccessTime metav1.Time `json:"minSuccessTime,omitempty"` + // ProgressDeadline defines how long the workload applier controller will wait until workload reaches a successful + // state in the cluster, marking it as failed after the deadline. + // The default value is None meaning the workload applier will continue to wait for a status if did not reach the + // successful state. + // ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s // +kubebuilder:validation:Pattern="^(([0-9])+[h|m|s])|None$" // +kubebuilder:default:=None // +optional - Timeout string `json:"timeout,omitempty"` + ProgressDeadline string `json:"progressDeadline,omitempty"` + // MaxFailures is a percentage of or number of clusters in the current rollout that can fail before proceeding to the + // next rollout. + // Default is that no failures are tolerated. + // +kubebuilder:validation:Pattern="^((100|[0-9]{1,2})%|[0-9]+)$" + // +kubebuilder:default=0 + // +optional + MaxFailures string `json:"maxFailures,omitempty"` } // MandatoryDecisionGroup set the decision group name or group index. @@ -75,20 +100,23 @@ type MandatoryDecisionGroups struct { // RolloutAll is a RolloutStrategy Type type RolloutAll struct { // +optional - Timeout `json:",inline"` + RolloutConfig `json:",inline"` } // RolloutProgressivePerGroup is a RolloutStrategy Type type RolloutProgressivePerGroup struct { // +optional - MandatoryDecisionGroups `json:",inline"` + RolloutConfig `json:",inline"` // +optional - Timeout `json:",inline"` + MandatoryDecisionGroups `json:",inline"` } // RolloutProgressive is a RolloutStrategy Type type RolloutProgressive struct { + // +optional + RolloutConfig `json:",inline"` + // +optional MandatoryDecisionGroups `json:",inline"` @@ -97,7 +125,4 @@ type RolloutProgressive struct { // +kubebuilder:validation:XIntOrString // +optional MaxConcurrency intstr.IntOrString `json:"maxConcurrency,omitempty"` - - // +optional - Timeout `json:",inline"` } diff --git a/cluster/v1alpha1/zz_generated.deepcopy.go b/cluster/v1alpha1/zz_generated.deepcopy.go index a72d4c816..5de84d58a 100644 --- a/cluster/v1alpha1/zz_generated.deepcopy.go +++ b/cluster/v1alpha1/zz_generated.deepcopy.go @@ -197,15 +197,6 @@ func (in *ClusterClaimSpec) DeepCopy() *ClusterClaimSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterRolloutStatus) DeepCopyInto(out *ClusterRolloutStatus) { *out = *in - out.GroupKey = in.GroupKey - if in.LastTransitionTime != nil { - in, out := &in.LastTransitionTime, &out.LastTransitionTime - *out = (*in).DeepCopy() - } - if in.TimeOutTime != nil { - in, out := &in.TimeOutTime, &out.TimeOutTime - *out = (*in).DeepCopy() - } return } @@ -219,6 +210,21 @@ func (in *ClusterRolloutStatus) DeepCopy() *ClusterRolloutStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterRolloutStatusFunc) DeepCopyInto(out *ClusterRolloutStatusFunc) { + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRolloutStatusFunc. +func (in *ClusterRolloutStatusFunc) DeepCopy() *ClusterRolloutStatusFunc { + if in == nil { + return nil + } + out := new(ClusterRolloutStatusFunc) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MandatoryDecisionGroup) DeepCopyInto(out *MandatoryDecisionGroup) { *out = *in @@ -259,7 +265,7 @@ func (in *MandatoryDecisionGroups) DeepCopy() *MandatoryDecisionGroups { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RolloutAll) DeepCopyInto(out *RolloutAll) { *out = *in - out.Timeout = in.Timeout + in.RolloutConfig.DeepCopyInto(&out.RolloutConfig) return } @@ -273,12 +279,29 @@ func (in *RolloutAll) DeepCopy() *RolloutAll { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RolloutConfig) DeepCopyInto(out *RolloutConfig) { + *out = *in + in.MinSuccessTime.DeepCopyInto(&out.MinSuccessTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutConfig. +func (in *RolloutConfig) DeepCopy() *RolloutConfig { + if in == nil { + return nil + } + out := new(RolloutConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RolloutProgressive) DeepCopyInto(out *RolloutProgressive) { *out = *in + in.RolloutConfig.DeepCopyInto(&out.RolloutConfig) in.MandatoryDecisionGroups.DeepCopyInto(&out.MandatoryDecisionGroups) out.MaxConcurrency = in.MaxConcurrency - out.Timeout = in.Timeout return } @@ -295,8 +318,8 @@ func (in *RolloutProgressive) DeepCopy() *RolloutProgressive { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RolloutProgressivePerGroup) DeepCopyInto(out *RolloutProgressivePerGroup) { *out = *in + in.RolloutConfig.DeepCopyInto(&out.RolloutConfig) in.MandatoryDecisionGroups.DeepCopyInto(&out.MandatoryDecisionGroups) - out.Timeout = in.Timeout return } @@ -346,7 +369,7 @@ func (in *RolloutStrategy) DeepCopyInto(out *RolloutStrategy) { if in.All != nil { in, out := &in.All, &out.All *out = new(RolloutAll) - **out = **in + (*in).DeepCopyInto(*out) } if in.Progressive != nil { in, out := &in.Progressive, &out.Progressive @@ -370,19 +393,3 @@ func (in *RolloutStrategy) DeepCopy() *RolloutStrategy { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Timeout) DeepCopyInto(out *Timeout) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Timeout. -func (in *Timeout) DeepCopy() *Timeout { - if in == nil { - return nil - } - out := new(Timeout) - in.DeepCopyInto(out) - return out -} diff --git a/cluster/v1alpha1/zz_generated.swagger_doc_generated.go b/cluster/v1alpha1/zz_generated.swagger_doc_generated.go index 4cadc7a2e..e79ab4b83 100644 --- a/cluster/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/cluster/v1alpha1/zz_generated.swagger_doc_generated.go @@ -105,6 +105,17 @@ func (RolloutAll) SwaggerDoc() map[string]string { return map_RolloutAll } +var map_RolloutConfig = map[string]string{ + "": "RolloutConfig contains common configurations for the rollout strategies.", + "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 proceed 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 the workload applier controller will wait until workload reaches a successful state in the cluster, marking it as failed after the deadline. The default value is None meaning the workload applier will continue to wait for a status if did not reach the successful state. ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s", + "maxFailures": "MaxFailures is a percentage of or number of clusters in the current rollout that can fail before proceeding to the next rollout. Default is that no failures are tolerated.", +} + +func (RolloutConfig) SwaggerDoc() map[string]string { + return map_RolloutConfig +} + var map_RolloutProgressive = map[string]string{ "": "RolloutProgressive is a RolloutStrategy Type", "maxConcurrency": "MaxConcurrency is the max number of clusters to deploy workload concurrently. The default value for MaxConcurrency is determined from the clustersPerDecisionGroup defined in the placement->DecisionStrategy.", @@ -124,23 +135,14 @@ func (RolloutProgressivePerGroup) SwaggerDoc() map[string]string { var map_RolloutStrategy = map[string]string{ "": "Rollout strategy to apply workload to the selected clusters by Placement and DecisionStrategy.", - "type": "Rollout strategy Types are All, Progressive and ProgressivePerGroup 1) All means apply the workload to all clusters in the decision groups at once. 2) Progressive means apply the workload to the selected clusters progressively per cluster. The workload will not be applied to the next cluster unless one of the current applied clusters reach the successful state or timeout. 3) ProgressivePerGroup means apply the workload to decisionGroup clusters progressively per group. The workload will not be applied to the next decisionGroup unless all clusters in the current group reach the successful state or timeout.", - "all": "All define required fields for RolloutStrategy type All", - "progressive": "Progressive define required fields for RolloutStrategy type Progressive", - "progressivePerGroup": "ProgressivePerGroup define required fields for RolloutStrategy type ProgressivePerGroup", + "type": "Rollout strategy Types are All, Progressive and ProgressivePerGroup 1) All means apply the workload to all clusters in the decision groups at once. 2) Progressive means apply the workload to the selected clusters progressively per cluster. The workload will not\n be applied to the next cluster unless one of the current applied clusters reach the successful state and haven't\n breached the MaxFailures configuration.\n3) ProgressivePerGroup means apply the workload to decisionGroup clusters progressively per group. The workload\n will not be applied to the next decisionGroup unless all clusters in the current group reach the successful\n state and haven't breached the MaxFailures configuration.", + "all": "All defines required fields for RolloutStrategy type All", + "progressive": "Progressive defines required fields for RolloutStrategy type Progressive", + "progressivePerGroup": "ProgressivePerGroup defines required fields for RolloutStrategy type ProgressivePerGroup", } func (RolloutStrategy) SwaggerDoc() map[string]string { return map_RolloutStrategy } -var map_Timeout = map[string]string{ - "": "Timeout to consider while applying the workload.", - "timeout": "Timeout define how long workload applier controller will wait till workload reach 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", -} - -func (Timeout) SwaggerDoc() map[string]string { - return map_Timeout -} - // AUTO-GENERATED FUNCTIONS END HERE 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 ecd82e555..84a6571a3 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 @@ -334,23 +334,46 @@ spec: clusters by Placement and DecisionStrategy. properties: all: - description: All define required fields for RolloutStrategy + description: All defines required fields for RolloutStrategy type All properties: - timeout: + maxFailures: + default: 0 + description: MaxFailures is a percentage of or number + of clusters in the current rollout that can fail before + proceeding to the next rollout. Default is that no + failures are tolerated. + pattern: ^((100|[0-9]{1,2})%|[0-9]+)$ + type: string + minSuccessTime: + default: 0 + description: 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 proceed immediately after a successful + state is reached. MinSuccessTime must be defined in + [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s + format: date-time + type: string + progressDeadline: default: None - description: Timeout define how long workload applier - controller will wait till workload reach 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 + description: ProgressDeadline defines how long the workload + applier controller will wait until workload reaches + a successful state in the cluster, marking it as failed + after the deadline. The default value is None meaning + the workload applier will continue to wait for a status + if did not reach the successful state. 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 type: object progressive: - description: Progressive define required fields for RolloutStrategy + description: Progressive defines required fields for RolloutStrategy type Progressive properties: mandatoryDecisionGroups: @@ -387,20 +410,43 @@ spec: defined in the placement->DecisionStrategy. pattern: ^((100|[0-9]{1,2})%|[0-9]+)$ x-kubernetes-int-or-string: true - timeout: + maxFailures: + default: 0 + description: MaxFailures is a percentage of or number + of clusters in the current rollout that can fail before + proceeding to the next rollout. Default is that no + failures are tolerated. + pattern: ^((100|[0-9]{1,2})%|[0-9]+)$ + type: string + minSuccessTime: + default: 0 + description: 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 proceed immediately after a successful + state is reached. MinSuccessTime must be defined in + [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s + format: date-time + type: string + progressDeadline: default: None - description: Timeout define how long workload applier - controller will wait till workload reach 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 + description: ProgressDeadline defines how long the workload + applier controller will wait until workload reaches + a successful state in the cluster, marking it as failed + after the deadline. The default value is None meaning + the workload applier will continue to wait for a status + if did not reach the successful state. 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 type: object progressivePerGroup: - description: ProgressivePerGroup define required fields + description: ProgressivePerGroup defines required fields for RolloutStrategy type ProgressivePerGroup properties: mandatoryDecisionGroups: @@ -427,15 +473,38 @@ spec: type: string type: object type: array - timeout: + maxFailures: + default: 0 + description: MaxFailures is a percentage of or number + of clusters in the current rollout that can fail before + proceeding to the next rollout. Default is that no + failures are tolerated. + pattern: ^((100|[0-9]{1,2})%|[0-9]+)$ + type: string + minSuccessTime: + default: 0 + description: 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 proceed immediately after a successful + state is reached. MinSuccessTime must be defined in + [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s + format: date-time + type: string + progressDeadline: default: None - description: Timeout define how long workload applier - controller will wait till workload reach 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 + description: ProgressDeadline defines how long the workload + applier controller will wait until workload reaches + a successful state in the cluster, marking it as failed + after the deadline. The default value is None meaning + the workload applier will continue to wait for a status + if did not reach the successful state. 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 type: object @@ -447,11 +516,12 @@ spec: means apply the workload to the selected clusters progressively per cluster. The workload will not be applied to the next cluster unless one of the current applied clusters reach - the successful state or timeout. 3) ProgressivePerGroup - means apply the workload to decisionGroup clusters progressively - per group. The workload will not be applied to the next - decisionGroup unless all clusters in the current group - reach the successful state or timeout. + the successful state and haven't breached the MaxFailures + configuration. 3) ProgressivePerGroup means apply the + workload to decisionGroup clusters progressively per group. + The workload will not be applied to the next decisionGroup + unless all clusters in the current group reach the successful + state and haven't breached the MaxFailures configuration. enum: - All - Progressive