Skip to content

Commit

Permalink
Do more attempts (almost 6 mins total)
Browse files Browse the repository at this point in the history
Signed-off-by: Sergei Lukianov <[email protected]>
  • Loading branch information
Frostman committed Dec 31, 2024
1 parent 135b17c commit 8c7b324
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/fab/comp/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func EnforceKubeInstall(ctx context.Context, kube client.Client, cfg fabapi.Fabr
var err error

backoff := wait.Backoff{
Steps: 10,
Steps: 17,
Duration: 500 * time.Millisecond,
Factor: 1.5,
Jitter: 0.1,
Expand All @@ -149,7 +149,7 @@ func EnforceKubeInstall(ctx context.Context, kube client.Client, cfg fabapi.Fabr

attempt := 0
if err := retry.OnError(backoff, func(error) bool {
return true
return !apierrors.IsConflict(err)
}, func() error {
if attempt > 0 {
slog.Debug("Retrying create or update", "kind", kind, "name", name, "attempt", attempt)
Expand Down
2 changes: 1 addition & 1 deletion pkg/fab/recipe/control_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ func (c *ControlInstall) installWiring(ctx context.Context, kube client.Client)
attempt := 0

if err := retry.OnError(wait.Backoff{
Steps: 10,
Steps: 17,
Duration: 500 * time.Millisecond,
Factor: 1.5,
Jitter: 0.1,
Expand Down
9 changes: 4 additions & 5 deletions pkg/fab/recipe/control_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"go.githedgehog.com/fabricator/pkg/fab/comp/k9s"
"go.githedgehog.com/fabricator/pkg/fab/comp/zot"
coreapi "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/util/retry"
Expand Down Expand Up @@ -78,14 +77,14 @@ func (c *ControlUpgrade) Run(ctx context.Context) error {
}

backoff := wait.Backoff{
Steps: 10,
Steps: 17,
Duration: 500 * time.Millisecond,
Factor: 1.5,
Jitter: 0.1,
}

if err := retry.OnError(backoff, func(err error) bool {
return apierrors.ReasonForError(err) != metav1.StatusReasonUnknown
if err := retry.OnError(backoff, func(error) bool {
return true
}, func() error {
f, control, err := fab.GetFabAndControls(ctx, kube, false)
if err != nil {
Expand Down Expand Up @@ -187,7 +186,7 @@ func (c *ControlUpgrade) uploadAirgap(ctx context.Context, username, password st
}

backoff := wait.Backoff{
Steps: 10,
Steps: 17,
Duration: 500 * time.Millisecond,
Factor: 1.5,
Jitter: 0.1,
Expand Down

0 comments on commit 8c7b324

Please sign in to comment.