Skip to content

Commit 3fab667

Browse files
authored
Merge pull request #2050 from sayantani11/issue1973
Handle terminal errors in AzureCluster controller
2 parents 94d929a + 4176bc8 commit 3fab667

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

controllers/azurecluster_controller.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,15 @@ func (acr *AzureClusterReconciler) reconcileNormal(ctx context.Context, clusterS
220220
}
221221

222222
if err := acs.Reconcile(ctx); err != nil {
223-
// Handle transient errors
223+
// Handle terminal & transient errors
224224
var reconcileError azure.ReconcileError
225225
if errors.As(err, &reconcileError) {
226+
if reconcileError.IsTerminal() {
227+
acr.Recorder.Eventf(clusterScope.AzureCluster, corev1.EventTypeWarning, "ReconcileErrror", errors.Wrapf(err, "failed to reconcile AzureCluster").Error())
228+
log.Error(err, "failed to reconcile AzureCluster", "name", clusterScope.ClusterName())
229+
conditions.MarkFalse(azureCluster, infrav1.NetworkInfrastructureReadyCondition, infrav1.FailedReason, clusterv1.ConditionSeverityError, "")
230+
return reconcile.Result{}, nil
231+
}
226232
if reconcileError.IsTransient() {
227233
if azure.IsOperationNotDoneError(reconcileError) {
228234
log.V(2).Info(fmt.Sprintf("AzureCluster reconcile not done: %s", reconcileError.Error()))

0 commit comments

Comments
 (0)