From a1234311b0cd1735e6e6a35ebeeb730c0707f1c3 Mon Sep 17 00:00:00 2001 From: Mario Manno Date: Thu, 24 Oct 2024 13:28:57 +0200 Subject: [PATCH] Fix status conflict between agent and fleetcontroller fleetcontroller was updating the whole status, instead of the changed fields. --- .../reconciler/bundledeployment_controller.go | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/internal/cmd/controller/reconciler/bundledeployment_controller.go b/internal/cmd/controller/reconciler/bundledeployment_controller.go index 4a879b35a2..966de38d51 100644 --- a/internal/cmd/controller/reconciler/bundledeployment_controller.go +++ b/internal/cmd/controller/reconciler/bundledeployment_controller.go @@ -107,23 +107,15 @@ func (r *BundleDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Req State: string(summary.GetDeploymentState(bd)), } - var t *fleet.BundleDeployment - err = retry.RetryOnConflict(retry.DefaultRetry, func() error { - t = &fleet.BundleDeployment{} - err := r.Get(ctx, req.NamespacedName, t) - if err != nil { - return err - } - t.Status = bd.Status - return r.Status().Update(ctx, t) - }) + err = r.Status().Update(ctx, bd) if err != nil { - logger.V(1).Error(err, "Reconcile failed final update to bundle deployment status", "status", bd.Status) - } else { - metrics.BundleDeploymentCollector.Collect(ctx, t) + logger.V(1).Error(err, "Reconcile failed update to bundle deployment status, requeueing", "status", bd.Status) + return ctrl.Result{}, err } - return ctrl.Result{}, err + metrics.BundleDeploymentCollector.Collect(ctx, bd) + + return ctrl.Result{}, nil } // bundleDeploymentStatusChangedPredicate returns true if the bundledeployment