Skip to content

Commit f0f8c7b

Browse files
committed
Don't reconcile a failed deployment
Don't reconcile a failed deployment after the required number of retries if there are changes in the nodeset or watched resources. Signed-off-by: rabi <[email protected]>
1 parent 61d1832 commit f0f8c7b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

controllers/dataplane/openstackdataplanedeployment_controller.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,20 @@ func (r *OpenStackDataPlaneDeploymentReconciler) Reconcile(ctx context.Context,
109109
return ctrl.Result{}, nil
110110
}
111111

112+
// If the deployment has failed with backoff limit exceeded, do not reconcile
113+
// even if nodesets or other watched resources change. The deployment is in a
114+
// terminal failure state and should not be retried.
115+
if instance.Status.Conditions != nil {
116+
deploymentCondition := instance.Status.Conditions.Get(condition.DeploymentReadyCondition)
117+
if deploymentCondition != nil &&
118+
deploymentCondition.Severity == condition.SeverityError &&
119+
deploymentCondition.Reason == condition.JobReasonBackoffLimitExceeded {
120+
Log.Info("Deployment has failed with backoff limit exceeded, skipping reconciliation",
121+
"deployment", instance.Name)
122+
return ctrl.Result{}, nil
123+
}
124+
}
125+
112126
// initialize status if Conditions is nil, but do not reset if it already
113127
// exists
114128
isNewInstance := instance.Status.Conditions == nil
@@ -344,7 +358,11 @@ func (r *OpenStackDataPlaneDeploymentReconciler) Reconcile(ctx context.Context,
344358
severity,
345359
condition.DeploymentReadyErrorMessage,
346360
deploymentErrMsg)
347-
return ctrl.Result{}, fmt.Errorf("%s", deploymentErrMsg)
361+
if backoffLimitReached {
362+
return ctrl.Result{}, nil
363+
} else {
364+
return ctrl.Result{}, fmt.Errorf("%s", deploymentErrMsg)
365+
}
348366
}
349367

350368
if shouldRequeue {

0 commit comments

Comments
 (0)