Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.4] 🐛 Retry Node delete when CCT is locked #9583

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions internal/controllers/machine/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@killianmuldoon can we revert this part? remote.RESTConfig never returns this error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right - I'll revert

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)
Expand Down Expand Up @@ -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
}

Expand Down