Skip to content

Commit

Permalink
Merge pull request #395 from kingdonb/patch-finalizers
Browse files Browse the repository at this point in the history
Use patch instead of update when adding finalizers
  • Loading branch information
stefanprodan authored Jan 14, 2022
2 parents 3805507 + 0498e9e commit 0246b7d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/helmrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ func (r *HelmReleaseReconciler) Reconcile(ctx context.Context, req ctrl.Request)

// Add our finalizer if it does not exist
if !controllerutil.ContainsFinalizer(&hr, v2.HelmReleaseFinalizer) {
patch := client.MergeFrom(hr.DeepCopy())
controllerutil.AddFinalizer(&hr, v2.HelmReleaseFinalizer)
if err := r.Update(ctx, &hr); err != nil {
if err := r.Patch(ctx, &hr, patch); err != nil {
log.Error(err, "unable to register finalizer")
return ctrl.Result{}, err
}
Expand Down

0 comments on commit 0246b7d

Please sign in to comment.