Skip to content

Commit

Permalink
ClusterCacheTracker: Use RequeueAfter 1 minute instead of immediate r…
Browse files Browse the repository at this point in the history
…equeue when ErrClusterLocked gets returned to not fall into exponential requeue
  • Loading branch information
chrischdi committed Dec 5, 2023
1 parent da206f1 commit 8d65d25
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion controllers/serviceaccount_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"reflect"
"strconv"
"strings"
"time"

"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -210,7 +211,7 @@ func (r *ServiceAccountReconciler) Reconcile(ctx context.Context, req reconcile.
if err != nil {
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
return ctrl.Result{RequeueAfter: time.Minute}, nil

Check warning on line 214 in controllers/serviceaccount_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/serviceaccount_controller.go#L214

Added line #L214 was not covered by tests
}
log.Error(err, "The control plane is not ready yet")
return reconcile.Result{RequeueAfter: clusterNotReadyRequeueTime}, nil
Expand Down
2 changes: 1 addition & 1 deletion controllers/servicediscovery_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (r *serviceDiscoveryReconciler) Reconcile(ctx context.Context, req reconcil
if err != nil {
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
return ctrl.Result{RequeueAfter: time.Minute}, nil

Check warning on line 192 in controllers/servicediscovery_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/servicediscovery_controller.go#L192

Added line #L192 was not covered by tests
}
log.Error(err, "The control plane is not ready yet")
return reconcile.Result{RequeueAfter: clusterNotReadyRequeueTime}, nil
Expand Down
2 changes: 1 addition & 1 deletion controllers/vspherevm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ func (r vmReconciler) deleteNode(ctx context.Context, vmCtx *capvcontext.VMConte
if err != nil {
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
return ctrl.Result{RequeueAfter: time.Minute}, nil

Check warning on line 376 in controllers/vspherevm_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/vspherevm_controller.go#L376

Added line #L376 was not covered by tests
}
return ctrl.Result{}, err
}
Expand Down

0 comments on commit 8d65d25

Please sign in to comment.