Skip to content

Commit

Permalink
Retry Node delete when CCT is locked
Browse files Browse the repository at this point in the history
Signed-off-by: killianmuldoon <kmuldoon@vmware.com>
  • Loading branch information
killianmuldoon committed Oct 18, 2023
1 parent ef2a1df commit 67e3f45
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/controllers/machine/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,11 @@ func (r *Reconciler) drainNode(ctx context.Context, cluster *clusterv1.Cluster,

restConfig, err := r.Tracker.GetRESTConfig(ctx, 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
}
restConfig = rest.CopyConfig(restConfig)
Expand Down Expand Up @@ -700,7 +704,11 @@ 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) {
log.V(5).Info("Requeuing delete Node because another worker has the lock on the ClusterCacheTracker")
return err
}
log.Error(err, "Error creating a remote client for cluster while deleting Node, won't retry")
return nil
}

Expand Down

0 comments on commit 67e3f45

Please sign in to comment.