1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 07:57:07 +00:00
kyverno/test/policy/deny/policy.yaml
Vyankatesh Kudtarkar c2de92d8c6
Support mutation of variables in validate.deny (#2947)
* Support mutation of variables in validate.deny

* remove comment

* fix e2e test
2022-01-18 10:53:30 +00:00

29 lines
856 B
YAML

---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: path-canonicalize
spec:
validationFailureAction: enforce
background: false
rules:
- name: disallow-mount-containerd-sock
match:
resources:
kinds:
- Pod
validate:
foreach:
- list: "request.object.spec.volumes[]"
deny:
conditions:
any:
- key: "{{ path_canonicalize(element.hostPath.path) }}"
operator: Equals
value: "/var/run/containerd/containerd.sock"
- key: "{{ path_canonicalize(element.hostPath.path) }}"
operator: Equals
value: "/run/containerd/containerd.sock"
- key: "{{ path_canonicalize(element.hostPath.path) }}"
operator: Equals
value: "\\var\\run\\containerd\\containerd.sock"