Skip to content

Commit f426035

Browse files
authored
Merge pull request #8090 from sbueringer/pr-capd-noisy
🌱 CAPD: reduce noisy error logs during machine reconciliation
2 parents 4fdf6cb + 835cf22 commit f426035

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/infrastructure/docker/internal/controllers/dockermachine_controller.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,17 @@ func (r *DockerMachineReconciler) reconcileNormal(ctx context.Context, cluster *
331331
return ctrl.Result{RequeueAfter: 5 * time.Second}, nil
332332
}
333333

334+
// If the Cluster is using a control plane and the control plane is not yet initialized, there is no API server
335+
// to contact to get the ProviderID for the Node hosted on this machine, so return early.
336+
// NOTE: We are using RequeueAfter with a short interval in order to make test execution time more stable.
337+
// NOTE: If the Cluster doesn't use a control plane, the ControlPlaneInitialized condition is only
338+
// set to true after a control plane machine has a node ref. If we would requeue here in this case, the
339+
// Machine will never get a node ref as ProviderID is required to set the node ref, so we would get a deadlock.
340+
if cluster.Spec.ControlPlaneRef != nil &&
341+
!conditions.IsTrue(cluster, clusterv1.ControlPlaneInitializedCondition) {
342+
return ctrl.Result{RequeueAfter: 15 * time.Second}, nil
343+
}
344+
334345
// Usually a cloud provider will do this, but there is no docker-cloud provider.
335346
// Requeue if there is an error, as this is likely momentary load balancer
336347
// state changes during control plane provisioning.

0 commit comments

Comments
 (0)