1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-10 01:46:55 +00:00
kyverno/test/cli/test/variables/cm-array-example.yaml
Mariam Fahmy 2140a0239b
chore: rename validationFailureAction to failureAction under the rule (#10893)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2024-08-27 20:07:57 +00:00

29 lines
759 B
YAML

---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: cm-array-example
spec:
admission: true
background: false
rules:
- context:
- configMap:
name: roles-dictionary
namespace: default
name: roles-dictionary
match:
any:
- resources:
kinds:
- Pod
name: validate-role-annotation
validate:
deny:
conditions:
- key: '{{ request.object.metadata.annotations.role }}'
operator: NotIn
value: '{{ "roles-dictionary".data."allowed-roles" }}'
message: 'The role {{ request.object.metadata.annotations.role }} is not in
the allowed list of roles: {{ "roles-dictionary".data."allowed-roles" }}.'
failureAction: Enforce