Skip to content

Commit

Permalink
Merge pull request #660 from fluxcd/update-patch-logic
Browse files Browse the repository at this point in the history
controllers: update status patch logic
  • Loading branch information
hiddeco authored Mar 30, 2023
2 parents acf0cda + ad21e7e commit 6f0fd5f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/controllers/helmrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,12 +751,13 @@ func (r *HelmReleaseReconciler) handleHelmActionResult(ctx context.Context,
}

func (r *HelmReleaseReconciler) patchStatus(ctx context.Context, hr *v2.HelmRelease) error {
key := client.ObjectKeyFromObject(hr)
latest := &v2.HelmRelease{}
if err := r.Client.Get(ctx, key, latest); err != nil {
if err := r.Client.Get(ctx, client.ObjectKeyFromObject(hr), latest); err != nil {
return err
}
return r.Client.Status().Patch(ctx, hr, client.MergeFrom(latest))
patch := client.MergeFrom(latest.DeepCopy())
latest.Status = hr.Status
return r.Client.Status().Patch(ctx, latest, patch, client.FieldOwner(r.ControllerName))
}

func (r *HelmReleaseReconciler) requestsForHelmChartChange(o client.Object) []reconcile.Request {
Expand Down

0 comments on commit 6f0fd5f

Please sign in to comment.