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.
More hard Kyverno questions
- 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?
- What is the purpose of the 'context' field in a Kyverno policy?