1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
kyverno/test/cli/test-validating-admission-policy/disallow-host-path/policy.yaml
Mariam Fahmy 7fd2d1a5a3
fix: rename vap to its full name (#7929)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2023-07-28 16:02:50 +08:00

14 lines
502 B
YAML

apiVersion: admissionregistration.k8s.io/v1alpha1
kind: ValidatingAdmissionPolicy
metadata:
name: "disallow-host-path"
spec:
matchConstraints:
resourceRules:
- apiGroups: [""]
apiVersions: ["v1"]
operations: ["CREATE", "UPDATE"]
resources: ["pods"]
validations:
- expression: "!has(object.spec.volumes) || object.spec.volumes.all(volume, !has(volume.hostPath))"
message: "HostPath volumes are forbidden. The field spec.volumes[*].hostPath must be unset."