homelab-gitops/platform/kyverno/policies/30-disallow/disallow-hostpath-volumes.yaml
gwg313 e507515766
Some checks are pending
Pipelines as Code CI / homelab-ci CI has Started
add pac
Signed-off-by: gwg313 <gwg313@pm.me>
2026-06-29 21:03:51 -04:00

26 lines
585 B
YAML

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-hostpath-volumes
spec:
validationFailureAction: Enforce
rules:
- name: no-hostpath
match:
any:
- resources:
kinds: ["Pod"]
exclude:
any:
- resources:
namespaceSelector:
matchLabels:
policy.home.arpa/allow-hostpath: "true"
validate:
message: "hostPath volumes are not allowed (escape risk)."
pattern:
spec:
volumes:
- (hostPath): null