Created
January 31, 2024 22:17
-
-
Save identw/a9d9492c843ae85cc46d27cbc1614ca3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: templates.gatekeeper.sh/v1beta1 | |
kind: ConstraintTemplate | |
metadata: | |
name: k8spsphostnamespace | |
annotations: | |
description: Controls usage of host namespaces. | |
spec: | |
crd: | |
spec: | |
names: | |
kind: K8sPSPHostNamespace | |
targets: | |
- target: admission.k8s.gatekeeper.sh | |
rego: | | |
package k8spsphostnamespace | |
violation[{"msg": msg, "details": {}}] { | |
input_share_hostnamespace(input.review.object) | |
msg := sprintf("Sharing the host namespace is not allowed: %v", [input.review.object.metadata.name]) | |
} | |
input_share_hostnamespace(o) { | |
o.spec.hostPID | |
} | |
input_share_hostnamespace(o) { | |
o.spec.hostIPC | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment