diff --git a/internal/controllers/machine/machine_controller.go b/internal/controllers/machine/machine_controller.go index 75d8b78a6ede..6724d9afbd67 100644 --- a/internal/controllers/machine/machine_controller.go +++ b/internal/controllers/machine/machine_controller.go @@ -582,7 +582,11 @@ func (r *Reconciler) drainNode(ctx context.Context, cluster *clusterv1.Cluster, restConfig, err := remote.RESTConfig(ctx, controllerName, r.Client, util.ObjectKey(cluster)) if err != nil { - log.Error(err, "Error creating a remote client while deleting Machine, won't retry") + if errors.Is(err, remote.ErrClusterLocked) { + log.V(5).Info("Requeuing drain Node because another worker has the lock on the ClusterCacheTracker") + return ctrl.Result{Requeue: true}, nil + } + log.Error(err, "Error creating a remote client for cluster while draining Node, won't retry") return ctrl.Result{}, nil } kubeClient, err := kubernetes.NewForConfig(restConfig) @@ -676,7 +680,10 @@ func (r *Reconciler) deleteNode(ctx context.Context, cluster *clusterv1.Cluster, remoteClient, err := r.Tracker.GetClient(ctx, util.ObjectKey(cluster)) if err != nil { - log.Error(err, "Error creating a remote client for cluster while deleting Machine, won't retry") + if errors.Is(err, remote.ErrClusterLocked) { + return errors.Wrapf(err, "failed deleting Node because another worker has the lock on the ClusterCacheTracker") + } + log.Error(err, "Error creating a remote client for cluster while deleting Node, won't retry") return nil }