From 7a53be3ea45d28b6f7b97deab2115ec2b1c87399 Mon Sep 17 00:00:00 2001 From: Mario Manno Date: Fri, 24 Nov 2023 16:33:54 +0100 Subject: [PATCH] Increase fleet agent update status retry time to up to 5s --- .../agent/controller/bundledeployment_controller.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/cmd/agent/controller/bundledeployment_controller.go b/internal/cmd/agent/controller/bundledeployment_controller.go index 9ceaf6959a..1df75ca780 100644 --- a/internal/cmd/agent/controller/bundledeployment_controller.go +++ b/internal/cmd/agent/controller/bundledeployment_controller.go @@ -3,6 +3,7 @@ package controller import ( "context" "fmt" + "time" "github.com/go-logr/logr" "github.com/rancher/fleet/internal/cmd/agent/deployer" @@ -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" @@ -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 @@ -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 {