k8wiz
Kyverno
Hard
Validation

In a Kyverno validate pattern, what does the X() negation anchor mean, as in 'X(hostPath): "null"'?

Select your answer:

Show answer and explanation

Answer: The field must not be present

Explanation

X() fails validation when the tagged field exists, whatever its value, so X(hostPath) under volumes rejects any hostPath volume. The value after it is ignored, and "null" is the convention. Other anchors include () for conditions, ^() for existence in lists, and =() for checking a field only when it's present.