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.
More hard Kyverno questions
- In a Kyverno validate pattern, what does the X() negation anchor mean, as in 'X(hostPath): "null"'?
- Which Kyverno resource exempts specific resources from a policy rule without editing the policy?
- What does the 'kyverno test' command read to run policy tests?
- Why must background be set to false on a Kyverno policy whose rules use request.userInfo, such as the requesting user's name or roles?
- In recent Kyverno versions, where should you set Enforce or Audit for a validate rule?
- Kyverno 1.16 ships CEL-based policy types at API version v1beta1. Which one validates resources with CEL expressions, in the style of Kubernetes ValidatingAdmissionPolicy?