k8wiz
Kyverno
Hard
Mutation

In a Kyverno mutate overlay (patchStrategicMerge), what does the +() anchor do, as in '+(imagePullPolicy): IfNotPresent'?

Select your answer:

Show answer and explanation

Answer: Adds the field only if it isn't already set

Explanation

+() is the add-if-not-present anchor. In this example Kyverno sets imagePullPolicy only on containers that don't define one and leaves existing values alone. Without the anchor, the overlay overwrites the field every time.