Skip to content

Commit

Permalink
Set different retry periods for CRDs
Browse files Browse the repository at this point in the history
Signed-off-by: Arnob kumar saha <arnob@appscode.com>
  • Loading branch information
ArnobKumarSaha committed Feb 22, 2024
1 parent 3dfab8a commit 79e7465
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apiextensions/v1/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1

import (
"context"
"time"

"github.com/pkg/errors"
api "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
Expand All @@ -29,6 +30,10 @@ import (
kutil "kmodules.xyz/client-go"
)

const (
RetryTimeout = 10 * time.Minute
)

func CreateOrUpdateCustomResourceDefinition(
ctx context.Context,
c cs.Interface,
Expand Down Expand Up @@ -70,7 +75,7 @@ func TryUpdateCustomResourceDefinition(
opts metav1.UpdateOptions,
) (result *api.CustomResourceDefinition, err error) {
attempt := 0
err = wait.PollUntilContextTimeout(ctx, kutil.RetryInterval, kutil.RetryTimeout, true, func(ctx context.Context) (bool, error) {
err = wait.PollUntilContextTimeout(ctx, kutil.RetryInterval, RetryTimeout, true, func(ctx context.Context) (bool, error) {
attempt++
cur, e2 := c.ApiextensionsV1().CustomResourceDefinitions().Get(ctx, name, metav1.GetOptions{})
if kerr.IsNotFound(e2) {
Expand Down

0 comments on commit 79e7465

Please sign in to comment.