1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-15 17:51:20 +00:00
kyverno/test/best_practices/select-secrets.yaml
Vyankatesh Kudtarkar 8eb1d4c7fb
Update variable paths when auto generate the controller rules (#1914)
* Fix Dev setup

* Update variable paths

* fix testcase issue

Co-authored-by: vyankatesh <vyankatesh@neualto.com>
2021-06-07 13:35:53 -07:00

28 lines
No EOL
801 B
YAML

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: select-secrets
spec:
background: false
validationFailureAction: enforce
rules:
- name: select-secrets-from-volumes
match:
resources:
kinds:
- Pod
context:
- name: volsecret
apiCall:
urlPath: "/api/v1/namespaces/{{request.object.metadata.namespace}}/secrets/{{request.object.spec.volumes[0].secret.secretName}}"
jmesPath: "metadata.labels.foo"
preconditions:
- 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/*"