Skip to content

Commit 29c9bb1

Browse files
committed
migrate from Requeue to RequeueAfter in extensionconfig
Signed-off-by: sivchari <[email protected]>
1 parent 4fae29c commit 29c9bb1

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ linters:
272272
- staticcheck
273273
text: 'SA1019: .*(res|result|i|j)\.Requeue is deprecated: Use `RequeueAfter` instead'
274274
# TODO: Remove Requeue step by step
275-
path: internal/controllers/(extensionconfig|machinepool)|util/util.go
275+
path: internal/controllers/machinepool
276276
# TODO: var-naming: avoid meaningless package names by revive
277277
# * test/infrastructure/docker/internal/docker/types/
278278
# * bootstrap/kubeadm/types/

internal/controllers/extensionconfig/extensionconfig_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"context"
2222
"fmt"
2323
"strings"
24+
"time"
2425

2526
"github.com/pkg/errors"
2627
corev1 "k8s.io/api/core/v1"
@@ -131,7 +132,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
131132
// Requeue events when the registry is not ready.
132133
// The registry will become ready after it is 'warmed up' by warmupRunnable.
133134
if !r.RuntimeClient.IsReady() {
134-
return ctrl.Result{Requeue: true}, nil
135+
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
135136
}
136137

137138
extensionConfig := &runtimev1.ExtensionConfig{}

internal/controllers/extensionconfig/extensionconfig_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func TestExtensionReconciler_Reconcile(t *testing.T) {
102102
res, err := r.Reconcile(ctx, ctrl.Request{NamespacedName: util.ObjectKey(extensionConfig)})
103103
g.Expect(err).ToNot(HaveOccurred())
104104
// If the registry isn't warm the reconcile loop will return Requeue: True
105-
g.Expect(res.Requeue).To(BeTrue())
105+
g.Expect(res.RequeueAfter).To((Equal(time.Duration(10))))
106106
})
107107

108108
t.Run("successful reconcile and discovery on ExtensionConfig create", func(*testing.T) {

util/util.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,8 @@ func IsSupportedVersionSkew(a, b semver.Version) bool {
690690

691691
// LowestNonZeroResult compares two reconciliation results
692692
// and returns the one with lowest requeue time.
693+
//
694+
//nolint:staticcheck // SA1019: Requeue is deprecated.
693695
func LowestNonZeroResult(i, j ctrl.Result) ctrl.Result {
694696
switch {
695697
case i.IsZero():

0 commit comments

Comments
 (0)