diff --git a/pkg/webhookconfig/monitor.go b/pkg/webhookconfig/monitor.go index 0ec98b8906..656546f8df 100644 --- a/pkg/webhookconfig/monitor.go +++ b/pkg/webhookconfig/monitor.go @@ -116,8 +116,12 @@ func (t *Monitor) Run(register *Register, certRenewer *tls.CertRenewer, eventGen // update namespaceSelector every 30 seconds go func() { if register.autoUpdateWebhooks { - logger.V(4).Info("updating webhook configurations for namespaceSelector with latest kyverno ConfigMap") - register.UpdateWebhookChan <- true + select { + case register.UpdateWebhookChan <- true: + logger.V(4).Info("updating webhook configurations for namespaceSelector with latest kyverno ConfigMap") + default: + logger.V(4).Info("skipped sending update webhook signal as the channel was blocking") + } } }() diff --git a/pkg/webhookconfig/registration.go b/pkg/webhookconfig/registration.go index d0696e99c0..57cdc40b0c 100644 --- a/pkg/webhookconfig/registration.go +++ b/pkg/webhookconfig/registration.go @@ -217,7 +217,12 @@ func (wrc *Register) UpdateWebhookConfigurations(configHandler config.Configurat if retry { go func() { time.Sleep(1 * time.Second) - wrc.UpdateWebhookChan <- true + select { + case wrc.UpdateWebhookChan <- true: + return + default: + return + } }() } }