Skip to content

Commit ccd7a2d

Browse files
authored
remove timeout field in rolloutstrategy v1alpha1 (#309)
Signed-off-by: haoqing0110 <[email protected]>
1 parent 01161c8 commit ccd7a2d

6 files changed

+126
-146
lines changed

addon/v1alpha1/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml

Lines changed: 63 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,19 @@ spec:
155155
default: 0
156156
description: MaxFailures is a percentage or number
157157
of clusters in the current rollout that can fail
158-
before proceeding to the next rollout. MaxFailures
159-
is only considered for rollout types Progressive
160-
and ProgressivePerGroup. For Progressive, this
161-
is considered over the total number of clusters.
162-
For ProgressivePerGroup, this is considered according
163-
to the size of the current group. For both Progressive
164-
and ProgressivePerGroup, the MaxFailures does
165-
not apply for MandatoryDecisionGroups, which tolerate
166-
no failures. Default is that no failures are tolerated.
158+
before proceeding to the next rollout. Fail means
159+
the cluster has a failed status or timeout status
160+
(does not reach successful status after ProgressDeadline).
161+
Once the MaxFailures is breached, the rollout
162+
will stop. MaxFailures is only considered for
163+
rollout types Progressive and ProgressivePerGroup.
164+
For Progressive, this is considered over the total
165+
number of clusters. For ProgressivePerGroup, this
166+
is considered according to the size of the current
167+
group. For both Progressive and ProgressivePerGroup,
168+
the MaxFailures does not apply for MandatoryDecisionGroups,
169+
which tolerate no failures. Default is that no
170+
failures are tolerated.
167171
pattern: ^((100|[0-9]{1,2})%|[0-9]+)$
168172
x-kubernetes-int-or-string: true
169173
minSuccessTime:
@@ -185,26 +189,18 @@ spec:
185189
default: None
186190
description: ProgressDeadline defines how long workload
187191
applier controller will wait for the workload
188-
to reach a successful state in the cluster. ProgressDeadline
189-
default value is "None", meaning the workload
190-
applier will wait for a successful state indefinitely.
192+
to reach a successful state in the cluster. If
193+
the workload does not reach a successful state
194+
after ProgressDeadline, will stop waiting and
195+
workload will be treated as "timeout" and be counted
196+
into MaxFailures. Once the MaxFailures is breached,
197+
the rollout will stop. ProgressDeadline default
198+
value is "None", meaning the workload applier
199+
will wait for a successful state indefinitely.
191200
ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s]
192201
format examples; 2h , 90m , 360s
193202
pattern: ^(([0-9])+[h|m|s])|None$
194203
type: string
195-
timeout:
196-
default: None
197-
description: "Timeout defines how long the workload
198-
applier controller will wait until the workload
199-
reaches a successful state in the cluster. Timeout
200-
default value is None meaning the workload applier
201-
will not proceed apply workload to other clusters
202-
if did not reach the successful state. Timeout
203-
must be defined in [0-9h]|[0-9m]|[0-9s] format
204-
examples; 2h , 90m , 360s \n Deprecated: Use ProgressDeadline
205-
instead."
206-
pattern: ^(([0-9])+[h|m|s])|None$
207-
type: string
208204
type: object
209205
progressive:
210206
description: Progressive defines required fields for
@@ -252,15 +248,19 @@ spec:
252248
default: 0
253249
description: MaxFailures is a percentage or number
254250
of clusters in the current rollout that can fail
255-
before proceeding to the next rollout. MaxFailures
256-
is only considered for rollout types Progressive
257-
and ProgressivePerGroup. For Progressive, this
258-
is considered over the total number of clusters.
259-
For ProgressivePerGroup, this is considered according
260-
to the size of the current group. For both Progressive
261-
and ProgressivePerGroup, the MaxFailures does
262-
not apply for MandatoryDecisionGroups, which tolerate
263-
no failures. Default is that no failures are tolerated.
251+
before proceeding to the next rollout. Fail means
252+
the cluster has a failed status or timeout status
253+
(does not reach successful status after ProgressDeadline).
254+
Once the MaxFailures is breached, the rollout
255+
will stop. MaxFailures is only considered for
256+
rollout types Progressive and ProgressivePerGroup.
257+
For Progressive, this is considered over the total
258+
number of clusters. For ProgressivePerGroup, this
259+
is considered according to the size of the current
260+
group. For both Progressive and ProgressivePerGroup,
261+
the MaxFailures does not apply for MandatoryDecisionGroups,
262+
which tolerate no failures. Default is that no
263+
failures are tolerated.
264264
pattern: ^((100|[0-9]{1,2})%|[0-9]+)$
265265
x-kubernetes-int-or-string: true
266266
minSuccessTime:
@@ -282,26 +282,18 @@ spec:
282282
default: None
283283
description: ProgressDeadline defines how long workload
284284
applier controller will wait for the workload
285-
to reach a successful state in the cluster. ProgressDeadline
286-
default value is "None", meaning the workload
287-
applier will wait for a successful state indefinitely.
285+
to reach a successful state in the cluster. If
286+
the workload does not reach a successful state
287+
after ProgressDeadline, will stop waiting and
288+
workload will be treated as "timeout" and be counted
289+
into MaxFailures. Once the MaxFailures is breached,
290+
the rollout will stop. ProgressDeadline default
291+
value is "None", meaning the workload applier
292+
will wait for a successful state indefinitely.
288293
ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s]
289294
format examples; 2h , 90m , 360s
290295
pattern: ^(([0-9])+[h|m|s])|None$
291296
type: string
292-
timeout:
293-
default: None
294-
description: "Timeout defines how long the workload
295-
applier controller will wait until the workload
296-
reaches a successful state in the cluster. Timeout
297-
default value is None meaning the workload applier
298-
will not proceed apply workload to other clusters
299-
if did not reach the successful state. Timeout
300-
must be defined in [0-9h]|[0-9m]|[0-9s] format
301-
examples; 2h , 90m , 360s \n Deprecated: Use ProgressDeadline
302-
instead."
303-
pattern: ^(([0-9])+[h|m|s])|None$
304-
type: string
305297
type: object
306298
progressivePerGroup:
307299
description: ProgressivePerGroup defines required fields
@@ -338,15 +330,19 @@ spec:
338330
default: 0
339331
description: MaxFailures is a percentage or number
340332
of clusters in the current rollout that can fail
341-
before proceeding to the next rollout. MaxFailures
342-
is only considered for rollout types Progressive
343-
and ProgressivePerGroup. For Progressive, this
344-
is considered over the total number of clusters.
345-
For ProgressivePerGroup, this is considered according
346-
to the size of the current group. For both Progressive
347-
and ProgressivePerGroup, the MaxFailures does
348-
not apply for MandatoryDecisionGroups, which tolerate
349-
no failures. Default is that no failures are tolerated.
333+
before proceeding to the next rollout. Fail means
334+
the cluster has a failed status or timeout status
335+
(does not reach successful status after ProgressDeadline).
336+
Once the MaxFailures is breached, the rollout
337+
will stop. MaxFailures is only considered for
338+
rollout types Progressive and ProgressivePerGroup.
339+
For Progressive, this is considered over the total
340+
number of clusters. For ProgressivePerGroup, this
341+
is considered according to the size of the current
342+
group. For both Progressive and ProgressivePerGroup,
343+
the MaxFailures does not apply for MandatoryDecisionGroups,
344+
which tolerate no failures. Default is that no
345+
failures are tolerated.
350346
pattern: ^((100|[0-9]{1,2})%|[0-9]+)$
351347
x-kubernetes-int-or-string: true
352348
minSuccessTime:
@@ -368,26 +364,18 @@ spec:
368364
default: None
369365
description: ProgressDeadline defines how long workload
370366
applier controller will wait for the workload
371-
to reach a successful state in the cluster. ProgressDeadline
372-
default value is "None", meaning the workload
373-
applier will wait for a successful state indefinitely.
367+
to reach a successful state in the cluster. If
368+
the workload does not reach a successful state
369+
after ProgressDeadline, will stop waiting and
370+
workload will be treated as "timeout" and be counted
371+
into MaxFailures. Once the MaxFailures is breached,
372+
the rollout will stop. ProgressDeadline default
373+
value is "None", meaning the workload applier
374+
will wait for a successful state indefinitely.
374375
ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s]
375376
format examples; 2h , 90m , 360s
376377
pattern: ^(([0-9])+[h|m|s])|None$
377378
type: string
378-
timeout:
379-
default: None
380-
description: "Timeout defines how long the workload
381-
applier controller will wait until the workload
382-
reaches a successful state in the cluster. Timeout
383-
default value is None meaning the workload applier
384-
will not proceed apply workload to other clusters
385-
if did not reach the successful state. Timeout
386-
must be defined in [0-9h]|[0-9m]|[0-9s] format
387-
examples; 2h , 90m , 360s \n Deprecated: Use ProgressDeadline
388-
instead."
389-
pattern: ^(([0-9])+[h|m|s])|None$
390-
type: string
391379
type: object
392380
type:
393381
default: All

cluster/v1alpha1/helpers.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ func progressivePerCluster(
283283
return existingClusterStatus[i].ClusterName < existingClusterStatus[j].ClusterName
284284
})
285285

286-
// Collect current cluster status and determine any TimeOut statuses
286+
// Collect existing cluster status and determine any TimeOut statuses
287287
for _, status := range existingClusterStatus {
288288
if status.ClusterName == "" {
289289
continue
@@ -293,6 +293,10 @@ func progressivePerCluster(
293293

294294
// If there was a breach of MaxFailures, only handle clusters that have already had workload applied
295295
if !failureBreach || failureBreach && status.Status != ToApply {
296+
// For progress per cluster, the length of existing `rolloutClusters` will be compared with the
297+
// target rollout size to determine whether to return or not first.
298+
// The timeoutClusters, as well as failed clusters will be counted into failureCount, the next rollout
299+
// will stop if failureCount > maxFailures.
296300
rolloutClusters, timeoutClusters = determineRolloutStatus(&status, minSuccessTime, timeout, rolloutClusters, timeoutClusters)
297301
}
298302

@@ -303,7 +307,7 @@ func progressivePerCluster(
303307
failureBreach = failureCount > maxFailures
304308
}
305309

306-
// Return if the list of rollout clusters has reached the target rollout size
310+
// Return if the list of exsiting rollout clusters has reached the target rollout size
307311
if len(rolloutClusters) >= rolloutSize {
308312
return RolloutResult{
309313
ClustersToRollout: rolloutClusters,
@@ -314,6 +318,7 @@ func progressivePerCluster(
314318
}
315319
}
316320

321+
// Return if the exsiting rollout clusters maxFailures is breached.
317322
if failureBreach {
318323
return RolloutResult{
319324
ClustersToRollout: rolloutClusters,
@@ -370,13 +375,16 @@ func progressivePerGroup(
370375
var rolloutClusters, timeoutClusters []ClusterRolloutStatus
371376
existingClusters := make(map[string]RolloutStatus)
372377

378+
// Collect existing cluster status and determine any TimeOut statuses
373379
for _, status := range existingClusterStatus {
374380
if status.ClusterName == "" {
375381
continue
376382
}
377383

378384
// ToApply will be reconsidered in the decisionGroups iteration.
379385
if status.Status != ToApply {
386+
// For progress per group, the existing rollout clusters and timeout clusters status will be recored in existingClusters first,
387+
// then go through group by group.
380388
rolloutClusters, timeoutClusters = determineRolloutStatus(&status, minSuccessTime, timeout, rolloutClusters, timeoutClusters)
381389
existingClusters[status.ClusterName] = status.Status
382390
}

cluster/v1alpha1/types_rolloutstrategy.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ type RolloutConfig struct {
6464
MinSuccessTime metav1.Duration `json:"minSuccessTime,omitempty"`
6565
// ProgressDeadline defines how long workload applier controller will wait for the workload to
6666
// reach a successful state in the cluster.
67+
// If the workload does not reach a successful state after ProgressDeadline, will stop waiting
68+
// and workload will be treated as "timeout" and be counted into MaxFailures. Once the MaxFailures
69+
// is breached, the rollout will stop.
6770
// ProgressDeadline default value is "None", meaning the workload applier will wait for a
6871
// successful state indefinitely.
6972
// ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s
@@ -72,7 +75,9 @@ type RolloutConfig struct {
7275
// +optional
7376
ProgressDeadline string `json:"progressDeadline,omitempty"`
7477
// MaxFailures is a percentage or number of clusters in the current rollout that can fail before
75-
// proceeding to the next rollout.
78+
// proceeding to the next rollout. Fail means the cluster has a failed status or timeout status
79+
// (does not reach successful status after ProgressDeadline).
80+
// Once the MaxFailures is breached, the rollout will stop.
7681
// MaxFailures is only considered for rollout types Progressive and ProgressivePerGroup. For
7782
// Progressive, this is considered over the total number of clusters. For ProgressivePerGroup,
7883
// this is considered according to the size of the current group. For both Progressive and
@@ -84,17 +89,6 @@ type RolloutConfig struct {
8489
// +kubebuilder:default=0
8590
// +optional
8691
MaxFailures intstr.IntOrString `json:"maxFailures,omitempty"`
87-
// Timeout defines how long the workload applier controller will wait until the workload reaches a
88-
// successful state in the cluster.
89-
// Timeout default value is None meaning the workload applier will not proceed apply workload to
90-
// other clusters if did not reach the successful state.
91-
// Timeout must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s
92-
//
93-
// Deprecated: Use ProgressDeadline instead.
94-
// +kubebuilder:validation:Pattern="^(([0-9])+[h|m|s])|None$"
95-
// +kubebuilder:default:="None"
96-
// +optional
97-
Timeout string `json:"timeout,omitempty"`
9892
}
9993

10094
// MandatoryDecisionGroup set the decision group name or group index.

cluster/v1alpha1/zz_generated.deepcopy.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)