Skip to content

Commit 1b56bf9

Browse files
authored
Merge pull request kubernetes-sigs#9810 from chrischdi/pr-errclusterlocked-requeue-minute
🐛 ClusterCacheTracker: Use RequeueAfter instead of immediate requeue on ErrClusterLocked to not have exponentially increasing requeue time
2 parents 9bea739 + 97aa208 commit 1b56bf9

File tree

9 files changed

+15
-13
lines changed

9 files changed

+15
-13
lines changed

bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func (r *KubeadmConfigReconciler) Reconcile(ctx context.Context, req ctrl.Reques
239239
// Requeue if the reconcile failed because the ClusterCacheTracker was locked for
240240
// the current cluster because of concurrent access.
241241
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
242-
return ctrl.Result{Requeue: true}, nil
242+
return ctrl.Result{RequeueAfter: time.Minute}, nil
243243
}
244244
return res, err
245245
}

controlplane/kubeadm/internal/controllers/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func (r *KubeadmControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.
243243
// the current cluster because of concurrent access.
244244
if errors.Is(err, remote.ErrClusterLocked) {
245245
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
246-
return ctrl.Result{Requeue: true}, nil
246+
return ctrl.Result{RequeueAfter: time.Minute}, nil
247247
}
248248
return res, err
249249
}
@@ -254,7 +254,7 @@ func (r *KubeadmControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.
254254
// the current cluster because of concurrent access.
255255
if errors.Is(err, remote.ErrClusterLocked) {
256256
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
257-
return ctrl.Result{Requeue: true}, nil
257+
return ctrl.Result{RequeueAfter: time.Minute}, nil
258258
}
259259
return res, err
260260
}

exp/internal/controllers/machinepool_controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package controllers
1919
import (
2020
"context"
2121
"fmt"
22+
"time"
2223

2324
"github.com/pkg/errors"
2425
corev1 "k8s.io/api/core/v1"
@@ -197,7 +198,7 @@ func (r *MachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Request)
197198
// the current cluster because of concurrent access.
198199
if errors.Is(err, remote.ErrClusterLocked) {
199200
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
200-
return ctrl.Result{Requeue: true}, nil
201+
return ctrl.Result{RequeueAfter: time.Minute}, nil
201202
}
202203
return ctrl.Result{}, err
203204
}
@@ -215,7 +216,7 @@ func (r *MachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Request)
215216
// the current cluster because of concurrent access.
216217
if errors.Is(err, remote.ErrClusterLocked) {
217218
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
218-
return ctrl.Result{Requeue: true}, nil
219+
return ctrl.Result{RequeueAfter: time.Minute}, nil
219220
}
220221
return res, err
221222
}

internal/controllers/machine/machine_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re
206206
// the current cluster because of concurrent access.
207207
if errors.Is(err, remote.ErrClusterLocked) {
208208
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
209-
return ctrl.Result{Requeue: true}, nil
209+
return ctrl.Result{RequeueAfter: time.Minute}, nil
210210
}
211211
return res, err
212212
}
@@ -224,7 +224,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re
224224
// the current cluster because of concurrent access.
225225
if errors.Is(err, remote.ErrClusterLocked) {
226226
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
227-
return ctrl.Result{Requeue: true}, nil
227+
return ctrl.Result{RequeueAfter: time.Minute}, nil
228228
}
229229
return res, err
230230
}
@@ -606,7 +606,7 @@ func (r *Reconciler) drainNode(ctx context.Context, cluster *clusterv1.Cluster,
606606
if err != nil {
607607
if errors.Is(err, remote.ErrClusterLocked) {
608608
log.V(5).Info("Requeuing drain Node because another worker has the lock on the ClusterCacheTracker")
609-
return ctrl.Result{Requeue: true}, nil
609+
return ctrl.Result{RequeueAfter: time.Minute}, nil
610610
}
611611
log.Error(err, "Error creating a remote client for cluster while draining Node, won't retry")
612612
return ctrl.Result{}, nil

internal/controllers/machinehealthcheck/machinehealthcheck_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re
176176
// the current cluster because of concurrent access.
177177
if errors.Is(err, remote.ErrClusterLocked) {
178178
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
179-
return ctrl.Result{Requeue: true}, nil
179+
return ctrl.Result{RequeueAfter: time.Minute}, nil
180180
}
181181
log.Error(err, "Failed to reconcile MachineHealthCheck")
182182
r.recorder.Eventf(m, corev1.EventTypeWarning, "ReconcileError", "%v", err)

internal/controllers/machineset/machineset_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re
184184
// the current cluster because of concurrent access.
185185
if errors.Is(err, remote.ErrClusterLocked) {
186186
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
187-
return ctrl.Result{Requeue: true}, nil
187+
return ctrl.Result{RequeueAfter: time.Minute}, nil
188188
}
189189
r.recorder.Eventf(machineSet, corev1.EventTypeWarning, "ReconcileError", "%v", err)
190190
}

internal/controllers/topology/cluster/cluster_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re
209209
// the current cluster because of concurrent access.
210210
if errors.Is(err, remote.ErrClusterLocked) {
211211
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
212-
return ctrl.Result{Requeue: true}, nil
212+
return ctrl.Result{RequeueAfter: time.Minute}, nil
213213
}
214214
}
215215
return result, err

test/infrastructure/docker/exp/internal/controllers/dockermachinepool_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package controllers
2020
import (
2121
"context"
2222
"fmt"
23+
"time"
2324

2425
"github.com/pkg/errors"
2526
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -158,7 +159,7 @@ func (r *DockerMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Re
158159
// the current cluster because of concurrent access.
159160
if errors.Is(err, remote.ErrClusterLocked) {
160161
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
161-
return ctrl.Result{Requeue: true}, nil
162+
return ctrl.Result{RequeueAfter: time.Minute}, nil
162163
}
163164
return res, err
164165
}

test/infrastructure/docker/internal/controllers/dockermachine_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func (r *DockerMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
195195
// the current cluster because of concurrent access.
196196
if errors.Is(err, remote.ErrClusterLocked) {
197197
log.V(5).Info("Requeuing because another worker has the lock on the ClusterCacheTracker")
198-
return ctrl.Result{Requeue: true}, nil
198+
return ctrl.Result{RequeueAfter: time.Minute}, nil
199199
}
200200
return res, err
201201
}

0 commit comments

Comments
 (0)