From c12b8c86aa539e43995830ca26b62cd798614080 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Fri, 3 Nov 2023 14:30:17 +0100 Subject: [PATCH] controller: ignore `NotFound` API error on delete Signed-off-by: Hidde Beydals --- internal/controller/helmrelease_controller.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/controller/helmrelease_controller.go b/internal/controller/helmrelease_controller.go index 62f69fe99..9c43e99fc 100644 --- a/internal/controller/helmrelease_controller.go +++ b/internal/controller/helmrelease_controller.go @@ -166,11 +166,10 @@ func (r *HelmReleaseReconciler) Reconcile(ctx context.Context, req ctrl.Request) } if err := patchHelper.Patch(ctx, obj, patchOpts...); err != nil { - if retErr != nil { - retErr = apierrutil.NewAggregate([]error{retErr, err}) - } else { - retErr = err + if !obj.DeletionTimestamp.IsZero() { + err = apierrutil.FilterOut(err, func(e error) bool { return apierrors.IsNotFound(e) }) } + retErr = apierrutil.Reduce(apierrutil.NewAggregate([]error{retErr, err})) } // Always record suspend, readiness and duration metrics.