From d218f296adb5d6c65c59a7ab1a75b98cd9b7b4c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Wei=C3=9Fe?= <66256922+daniel-weisse@users.noreply.github.com> Date: Tue, 24 Oct 2023 08:10:43 +0200 Subject: [PATCH] cli: increase kubecmd retry limit (#2500) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Weiße --- cli/internal/kubecmd/kubecmd.go | 6 +++--- cli/internal/kubecmd/kubecmd_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/internal/kubecmd/kubecmd.go b/cli/internal/kubecmd/kubecmd.go index 7a9a952a9..33f805ee4 100644 --- a/cli/internal/kubecmd/kubecmd.go +++ b/cli/internal/kubecmd/kubecmd.go @@ -52,7 +52,7 @@ import ( ) const ( - maxRetryAttempts = 5 + maxRetryAttempts = 20 ) // ErrInProgress signals that an upgrade is in progress inside the cluster. @@ -231,7 +231,7 @@ func (k *KubeCmd) ApplyJoinConfig(ctx context.Context, newAttestConfig config.At } retries++ k.log.Debugf("Getting join-config ConfigMap failed (attempt %d/%d): %s", retries, maxRetryAttempts, err) - return retries <= maxRetryAttempts + return retries < maxRetryAttempts } var joinConfig *corev1.ConfigMap @@ -488,7 +488,7 @@ func retryAction(ctx context.Context, retryInterval time.Duration, maxRetries in retrier := conretry.NewIntervalRetrier(&kubeDoer{action: action}, retryInterval, func(err error) bool { ctr++ log.Debugf("Action failed (attempt %d/%d): %s", ctr, maxRetries, err) - return ctr <= maxRetries + return ctr < maxRetries }) return retrier.Do(ctx) } diff --git a/cli/internal/kubecmd/kubecmd_test.go b/cli/internal/kubecmd/kubecmd_test.go index 9d1d37896..c905e38cf 100644 --- a/cli/internal/kubecmd/kubecmd_test.go +++ b/cli/internal/kubecmd/kubecmd_test.go @@ -484,7 +484,7 @@ func TestApplyJoinConfig(t *testing.T) { // be updated here repeatedErrors := func(err error) []error { var errs []error - for i := 0; i < 20; i++ { + for i := 0; i < 30; i++ { errs = append(errs, err) } return errs