diff --git a/controllers/objecttemplate_controller.go b/controllers/objecttemplate_controller.go index 0706594..eca3a0a 100644 --- a/controllers/objecttemplate_controller.go +++ b/controllers/objecttemplate_controller.go @@ -449,8 +449,9 @@ func (r *ObjectTemplateReconciler) finalize(ctx context.Context, obj *templatesv r.doFinalize(ctx, obj) // Remove our finalizer from the list and update it + patch := client.MergeFrom(obj.DeepCopy()) controllerutil.RemoveFinalizer(obj, templatesv1alpha1.ObjectTemplateFinalizer) - if err := r.Update(ctx, obj, client.FieldOwner(r.FieldManager)); err != nil { + if err := r.Patch(ctx, obj, patch, client.FieldOwner(r.FieldManager)); err != nil { return ctrl.Result{}, err } diff --git a/controllers/texttemplate_controller.go b/controllers/texttemplate_controller.go index 7f4e446..611e82e 100644 --- a/controllers/texttemplate_controller.go +++ b/controllers/texttemplate_controller.go @@ -212,8 +212,9 @@ func (r *TextTemplateReconciler) finalize(ctx context.Context, obj *templatesv1a r.watchesUtil.removeWatchesForTemplate(client.ObjectKeyFromObject(obj)) // Remove our finalizer from the list and update it + patch := client.MergeFrom(obj.DeepCopy()) controllerutil.RemoveFinalizer(obj, templatesv1alpha1.TextTemplateFinalizer) - if err := r.Update(ctx, obj, client.FieldOwner(r.FieldManager)); err != nil { + if err := r.Patch(ctx, obj, patch, client.FieldOwner(r.FieldManager)); err != nil { return ctrl.Result{}, err }