1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/test/best_practices/select-secrets.yaml
Charles-Edouard Brétéché 7562bea6db
chore: apply policy fixes (#8427)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-17 22:24:26 +00:00

34 lines
876 B
YAML

---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: select-secrets
spec:
admission: true
background: false
rules:
- context:
- apiCall:
jmesPath: metadata.labels.foo
method: GET
urlPath: /api/v1/namespaces/{{request.object.metadata.namespace}}/secrets/{{request.object.spec.volumes[0].secret.secretName}}
name: volsecret
match:
any:
- resources:
kinds:
- Pod
name: select-secrets-from-volumes
preconditions:
all:
- key: '{{ request.operation }}'
operator: Equals
value: CREATE
validate:
message: The Secret named {{request.object.spec.volumes[0].secret.secretName}}
is restricted and may not be used.
pattern:
spec:
containers:
- image: registry.domain.com/*
validationFailureAction: Enforce