Skip to content

Commit f25806a

Browse files
authored
fix: instruct the controller to stop retrying under specific circumstances
1 parent c376021 commit f25806a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

controllers/apps/configuration/sync_upgrade_policy.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ func sync(params reconfigureParams, updatedParameters map[string]string, pods []
9898
return makeReturnedStatus(ESFailedAndRetry), err
9999
}
100100
if len(pods) == 0 {
101+
if replicas == 0 {
102+
return makeReturnedStatus(ESNone), nil
103+
}
101104
params.Ctx.Log.Info(fmt.Sprintf("no pods to update, and retry, selector: %v", selector))
102105
return makeReturnedStatus(ESRetry), nil
103106
}

controllers/apps/transformer_component_validation.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ func validateCompReplicas(comp *appsv1alpha1.Component, compDef *appsv1alpha1.Co
9191
replicasLimit = compDef.Spec.ReplicasLimit
9292
}
9393
replicas := comp.Spec.Replicas
94-
if replicas >= replicasLimit.MinReplicas && replicas <= replicasLimit.MaxReplicas {
94+
// Allow replicas=0 (stopped state) to pass validation, as stopping a cluster is a valid operation.
95+
// This prevents infinite requeue loops for stopped clusters.
96+
if replicas == 0 || (replicas >= replicasLimit.MinReplicas && replicas <= replicasLimit.MaxReplicas) {
9597
return nil
9698
}
9799
return replicasOutOfLimitError(replicas, *replicasLimit)

0 commit comments

Comments
 (0)