1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
kyverno/pkg/policy/webhookregistration.go
Jim Bugwadia 65193feccb
update logging, naming, and event retry (#959)
* update logging and naming

* check per policy patch count
2020-06-30 11:53:27 -07:00

23 lines
539 B
Go

package policy
import (
"k8s.io/apimachinery/pkg/labels"
)
func (pc *PolicyController) removeResourceWebhookConfiguration() error {
logger := pc.log
var err error
// get all existing policies
policies, err := pc.pLister.List(labels.NewSelector())
if err != nil {
logger.Error(err, "failed to list policies")
return err
}
if len(policies) == 0 {
logger.V(4).Info("no policies loaded, removing resource webhook configuration if one exists")
pc.resourceWebhookWatcher.RemoveResourceWebhookConfiguration()
}
return nil
}