From bfb00cffc8f8877e0881403a123d774c277cd1f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Wed, 25 Sep 2024 13:08:03 +0200 Subject: [PATCH] fix: webhooks reconciliation when no policies (#11230) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- pkg/controllers/webhook/controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/controllers/webhook/controller.go b/pkg/controllers/webhook/controller.go index 42f110e305..6a1224442b 100644 --- a/pkg/controllers/webhook/controller.go +++ b/pkg/controllers/webhook/controller.go @@ -870,7 +870,7 @@ func (c *controller) buildResourceMutatingWebhookConfiguration(ctx context.Conte } func (c *controller) buildResourceMutatingWebhookRules(caBundle []byte, webhookCfg config.WebhookConfig, sideEffects *admissionregistrationv1.SideEffectClass, webhooks []*webhook, mapResourceToOpnType map[string][]admissionregistrationv1.OperationType) []admissionregistrationv1.MutatingWebhook { - mutatingWebhooks := make([]admissionregistrationv1.MutatingWebhook, 0, len(webhooks)) + var mutatingWebhooks []admissionregistrationv1.MutatingWebhook //nolint:prealloc for _, webhook := range webhooks { if webhook.isEmpty() { continue @@ -1046,7 +1046,7 @@ func (c *controller) buildResourceValidatingWebhookConfiguration(ctx context.Con } func (c *controller) buildResourceValidatingWebhookRules(caBundle []byte, webhookCfg config.WebhookConfig, sideEffects *admissionregistrationv1.SideEffectClass, webhooks []*webhook, mapResourceToOpnType map[string][]admissionregistrationv1.OperationType) []admissionregistrationv1.ValidatingWebhook { - validatingWebhooks := make([]admissionregistrationv1.ValidatingWebhook, 0, len(webhooks)) + var validatingWebhooks []admissionregistrationv1.ValidatingWebhook //nolint:prealloc for _, webhook := range webhooks { if webhook.isEmpty() { continue