Skip to content

Commit

Permalink
[v0.10] Fix status conflict between agent and fleetcontroller (#3005)
Browse files Browse the repository at this point in the history
Fix status conflict between agent and fleetcontroller

fleetcontroller was updating the whole status, instead of the changed
fields.

Co-authored-by: Mario Manno <[email protected]>
  • Loading branch information
aruiz14 and manno authored Oct 24, 2024
1 parent 809b8e9 commit 1b72b97
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions internal/cmd/controller/reconciler/bundledeployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1b72b97

Please sign in to comment.