From 943ea1c187a72b9ef70b6cb9c2317d1bf38a75b2 Mon Sep 17 00:00:00 2001 From: Ori Shavit Date: Wed, 25 Sep 2024 14:08:47 +0200 Subject: [PATCH] Use StrategicMergeFrom to update finalizers --- src/operator/controllers/iam/pods/pods_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operator/controllers/iam/pods/pods_controller.go b/src/operator/controllers/iam/pods/pods_controller.go index d65a40f..96ccabb 100644 --- a/src/operator/controllers/iam/pods/pods_controller.go +++ b/src/operator/controllers/iam/pods/pods_controller.go @@ -125,7 +125,7 @@ func (r *PodReconciler) handlePodCleanup(ctx context.Context, pod corev1.Pod) (c updatedPod := pod.DeepCopy() if controllerutil.RemoveFinalizer(updatedPod, r.agent.FinalizerName()) || controllerutil.RemoveFinalizer(updatedPod, metadata.DeprecatedIAMRoleFinalizer) { - err := r.Patch(ctx, updatedPod, client.MergeFrom(&pod)) + err := r.Patch(ctx, updatedPod, client.StrategicMergeFrom(&pod)) if err != nil { if apierrors.IsConflict(err) || apierrors.IsNotFound(err) || apierrors.IsForbidden(err) { // These are all errors that can happen because the pod is already being deleted, requeuing