From 835cf224612ad1bba15b7f31d27df1cf8210a836 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Thu, 9 Feb 2023 16:01:34 +0100 Subject: [PATCH] CAPD: reduce noisy error logs during machine reconciliation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Büringer buringerst@vmware.com --- .../internal/controllers/dockermachine_controller.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/infrastructure/docker/internal/controllers/dockermachine_controller.go b/test/infrastructure/docker/internal/controllers/dockermachine_controller.go index edc90b4232ee..9467b55aa24e 100644 --- a/test/infrastructure/docker/internal/controllers/dockermachine_controller.go +++ b/test/infrastructure/docker/internal/controllers/dockermachine_controller.go @@ -331,6 +331,17 @@ func (r *DockerMachineReconciler) reconcileNormal(ctx context.Context, cluster * return ctrl.Result{RequeueAfter: 5 * time.Second}, nil } + // If the Cluster is using a control plane and the control plane is not yet initialized, there is no API server + // to contact to get the ProviderID for the Node hosted on this machine, so return early. + // NOTE: We are using RequeueAfter with a short interval in order to make test execution time more stable. + // NOTE: If the Cluster doesn't use a control plane, the ControlPlaneInitialized condition is only + // set to true after a control plane machine has a node ref. If we would requeue here in this case, the + // Machine will never get a node ref as ProviderID is required to set the node ref, so we would get a deadlock. + if cluster.Spec.ControlPlaneRef != nil && + !conditions.IsTrue(cluster, clusterv1.ControlPlaneInitializedCondition) { + return ctrl.Result{RequeueAfter: 15 * time.Second}, nil + } + // Usually a cloud provider will do this, but there is no docker-cloud provider. // Requeue if there is an error, as this is likely momentary load balancer // state changes during control plane provisioning.