1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

fix: webhooks reconciliation when no policies (#11230)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2024-09-25 13:08:03 +02:00 committed by GitHub
parent e3b51e16a9
commit bfb00cffc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 { 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 { for _, webhook := range webhooks {
if webhook.isEmpty() { if webhook.isEmpty() {
continue 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 { 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 { for _, webhook := range webhooks {
if webhook.isEmpty() { if webhook.isEmpty() {
continue continue