Skip to content

Commit

Permalink
Increase fleet agent update status retry time to up to 5s
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Manno committed Nov 24, 2023
1 parent eeb3c76 commit 7a53be3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/cmd/agent/controller/bundledeployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package controller
import (
"context"
"fmt"
"time"

"github.com/go-logr/logr"
"github.com/rancher/fleet/internal/cmd/agent/deployer"
Expand All @@ -18,6 +19,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
errutil "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/util/retry"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -46,6 +48,13 @@ type BundleDeploymentReconciler struct {
AgentScope string
}

var DefaultRetry = wait.Backoff{
Steps: 5,
Duration: 5 * time.Second,
Factor: 1.0,
Jitter: 0.1,
}

//+kubebuilder:rbac:groups=fleet.cattle.io,resources=bundledeployments,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=fleet.cattle.io,resources=bundledeployments/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=fleet.cattle.io,resources=bundledeployments/finalizers,verbs=update
Expand Down Expand Up @@ -187,7 +196,7 @@ func setCondition(newStatus fleetv1.BundleDeploymentStatus, err error, cond cond
}

func updateStatus(ctx context.Context, logger logr.Logger, client client.Client, nsn types.NamespacedName, status fleetv1.BundleDeploymentStatus) error {
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
err := retry.RetryOnConflict(DefaultRetry, func() error {
newBD := &fleetv1.BundleDeployment{}
err := client.Get(ctx, nsn, newBD)
if err != nil {
Expand Down

0 comments on commit 7a53be3

Please sign in to comment.