1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-09 17:37:12 +00:00
kyverno/test/conformance/chainsaw/webhook-configurations/match-conditions-userinfo/policy.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

43 lines
No EOL
1 KiB
YAML

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
annotations:
pod-policies.kyverno.io/autogen-controllers: none
name: cpol-match-conditions-userinfo
spec:
admission: true
background: true
webhookConfiguration:
matchConditions:
- name: "select-namespace"
expression: '(object.metadata.namespace == "match-conditions-userinfo-ns")'
- name: 'select-by-groups'
expression: '("system:masters" in request.userInfo.groups)'
rules:
- match:
any:
- resources:
kinds:
- Pod
name: require-image-tag
validate:
failureAction: Enforce
message: An image tag is required
pattern:
spec:
containers:
- image: '*:*'
- match:
any:
- resources:
kinds:
- Pod
name: validate-image-tag
validate:
failureAction: Enforce
message: Using a mutable image tag e.g. 'latest' is not allowed
pattern:
spec:
containers:
- image: '!*:latest'
failurePolicy: Ignore