kyverno / kyverno

Kubernetes Native Policy Management
https://kyverno.io
Apache License 2.0
5.31k stars 798 forks source link

[Feature] Allow disabling PolicyViolation events in resources while keeping them in ClusterPolicies/Policies #10434

Open AndresPinerosZen opened 3 weeks ago

AndresPinerosZen commented 3 weeks ago

Problem Statement

I don't want PolicyViolation events to be visible in the Kubenretes resources (Deployment, Job...), but I want them to be visible in the ClusterPolicies/Policies.

This is helpful whenever a cluster manager is setting Audit mode policies to understand the violations in the cluster. The Audit policies shouldn't disturb the teams that own the resources, until the cluster manager wants that to happen. If a client sees a bunch of PolicyViolation warnings, they are probably going to think something is broken.

I apologize if this has already been requested, I couldn't find anything that matches what I need.

Solution Description

Provide a flag to disable the events in the resources, while keeping the events in the ClusterPolicy resources.

Alternatives

No response

Additional Context

No response

Slack discussion

https://kubernetes.slack.com/archives/CLGR9BJU9/p1718151960040999

Research

welcome[bot] commented 3 weeks ago

Thanks for opening your first issue here! Be sure to follow the issue template!

chipzoller commented 3 weeks ago

Responded in the Slack thread you later opened. omitEvents flag can be used to globally control events but not on a granular level.