mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 07:57:07 +00:00
28 lines
801 B
YAML
28 lines
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/*"
|