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

🐛 ClusterResourceSet: continue applying when apply for a single cluster failed #8611

Merged
merged 1 commit into from
May 9, 2023
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
18 changes: 16 additions & 2 deletions exp/addons/internal/controllers/clusterresourceset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,32 @@ func (r *ClusterResourceSetReconciler) Reconcile(ctx context.Context, req ctrl.R
return r.reconcileDelete(ctx, clusters, clusterResourceSet)
}

errs := []error{}
errClusterLockedOccurred := false
for _, cluster := range clusters {
if err := r.ApplyClusterResourceSet(ctx, cluster, clusterResourceSet); err != nil {
// Requeue if the reconcile failed because the ClusterCacheTracker was locked for
// the current cluster because of concurrent access.
if errors.Is(err, remote.ErrClusterLocked) {
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
return ctrl.Result{Requeue: true}, nil
errClusterLockedOccurred = true
} else {
// Append the error if the error is not ErrClusterLocked.
errs = append(errs, err)
}
return ctrl.Result{}, err
}
}

// Return an aggregated error if errors occurred.
if len(errs) > 0 {
return ctrl.Result{}, kerrors.NewAggregate(errs)
}

// Requeue if ErrClusterLocked was returned for one of the clusters.
if errClusterLockedOccurred {
return ctrl.Result{Requeue: true}, nil
}

return ctrl.Result{}, nil
}

Expand Down