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

🐛 retry delete during clusterctl upgrade #6266

Merged
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
16 changes: 11 additions & 5 deletions cmd/clusterctl/client/cluster/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,18 @@ func (p *providerComponents) Delete(options DeleteOptions) error {

// Otherwise delete the object
log.V(5).Info("Deleting", logf.UnstructuredToValues(obj)...)
if err := cs.Delete(ctx, &obj); err != nil {
if apierrors.IsNotFound(err) {
// Tolerate IsNotFound error that might happen because we are not enforcing a deletion order
// that considers relation across objects (e.g. Deployments -> ReplicaSets -> Pods)
continue
deleteBackoff := newWriteBackoff()
if err := retryWithExponentialBackoff(deleteBackoff, func() error {
if err := cs.Delete(ctx, &obj); err != nil {
if apierrors.IsNotFound(err) {
// Tolerate IsNotFound error that might happen because we are not enforcing a deletion order
// that considers relation across objects (e.g. Deployments -> ReplicaSets -> Pods)
return nil
}
return err
}
return nil
}); err != nil {
errList = append(errList, errors.Wrapf(err, "Error deleting object %s, %s/%s", obj.GroupVersionKind(), obj.GetNamespace(), obj.GetName()))
}
}
Expand Down