k8wiz
Kyverno
Hard
Mutation

A Kyverno MutatingPolicy matches Pods, keeps the default autogen settings and uses a JSONPatch on /metadata/annotations. What happens in its Deployment variant?

Select your answer:

Show answer and explanation

Answer: The path is copied unchanged, so it patches the Deployment itself

Explanation

Autogen rewrites object.spec and metadata label and annotation references in matchConditions and ApplyConfiguration expressions so they point at the Pod template. JSONPatch expressions are copied as written, so their paths still target the top-level object. Keep JSONPatch Pod mutations in a policy with autogen.podControllers.enabled set to false, or use ApplyConfiguration.

Read more about Kyverno