Created
February 19, 2021 14:20
-
-
Save jmassardo/646458b15545d306c12931a22285d5dc to your computer and use it in GitHub Desktop.
Simple Rego rule to exclude certain k8s namespaces
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
# List of namespaces to exclude | |
excludedNamespaces = {"good", "ok"} | |
imageSafety[decision] { | |
# This rule compares the namespace from the admission controller | |
# to the list of namespaces above | |
not excludedNamespaces[input.request.namespace] | |
data.library.v1.kubernetes.admission.workload.v1.block_latest_image_tag[message] | |
decision := { | |
"allowed": false, | |
"message": message | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment