Skip to content

Commit 4176bc8

Browse files
committed
Handle terminal errors in AzureCluster controller
1 parent 9940f37 commit 4176bc8

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
@@ -219,9 +219,15 @@ func (acr *AzureClusterReconciler) reconcileNormal(ctx context.Context, clusterS
219219
}
220220

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

0 commit comments

Comments
 (0)