Kyverno
Medium
Policies
Which of the following is a valid way to use a variable in a Kyverno policy pattern?
Select your answer:
Show answer and explanation
Answer: metadata.name: {{var1}}
Explanation
Kyverno variables are JMESPath expressions in double braces. A context entry named var1 is referenced as {{var1}}, and request data as {{request.object.metadata.name}}. ${var1} is Flux and shell syntax, and $( ) in a pattern refers to another field of the same resource, not to a variable.
More medium Kyverno questions
- What is the purpose of the 'kyverno.io/generated-by' annotation?
- In a kyverno-test.yaml results entry, which field marks the result as coming from a CEL-based ValidatingPolicy?
- What happens when a resource violates a Kyverno validation policy with 'validationFailureAction' set to 'enforce'?
- What is the purpose of a generation rule in Kyverno?
- Which of the following is NOT a valid resource selection method in Kyverno policies?
- What is the purpose of the 'background' field in a Kyverno policy?