From cd4e5340e3e2b552255eeeda6c9536996ebc42a4 Mon Sep 17 00:00:00 2001 From: Enrico Candino Date: Sun, 12 Apr 2026 00:29:42 +0200 Subject: [PATCH] check err nillness (#774) --- k3k-kubelet/controller/webhook/pod.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/k3k-kubelet/controller/webhook/pod.go b/k3k-kubelet/controller/webhook/pod.go index dc225d97..0c202aa7 100644 --- a/k3k-kubelet/controller/webhook/pod.go +++ b/k3k-kubelet/controller/webhook/pod.go @@ -26,8 +26,10 @@ func RemovePodMutatingWebhook(ctx context.Context, virtualClient, hostClient ctr }, } - if err := hostClient.Delete(ctx, webhookSecret); !apierrors.IsNotFound(err) { - return err + if err := hostClient.Delete(ctx, webhookSecret); err != nil { + if !apierrors.IsNotFound(err) { + return err + } } webhook := &admissionregistrationv1.MutatingWebhookConfiguration{ @@ -40,8 +42,10 @@ func RemovePodMutatingWebhook(ctx context.Context, virtualClient, hostClient ctr }, } - if err := virtualClient.Delete(ctx, webhook); !apierrors.IsNotFound(err) { - return err + if err := virtualClient.Delete(ctx, webhook); err != nil { + if !apierrors.IsNotFound(err) { + return err + } } return nil