Skip to content

Commit

Permalink
remove timeout field in rolloutstrategy v1alpha1
Browse files Browse the repository at this point in the history
Signed-off-by: haoqing0110 <[email protected]>
  • Loading branch information
haoqing0110 committed Jan 2, 2024
1 parent 04e951f commit af6d56c
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions cluster/v1alpha1/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -314,6 +317,7 @@ func progressivePerCluster(
}
}

// Return if the maxFailures is breached.
if failureBreach {
return RolloutResult{
ClustersToRollout: rolloutClusters,
Expand Down Expand Up @@ -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
}
Expand Down
15 changes: 3 additions & 12 deletions cluster/v1alpha1/types_rolloutstrategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions cluster/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions cluster/v1alpha1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit af6d56c

Please sign in to comment.