Skip to content

Instantly share code, notes, and snippets.

@jmassardo
Created February 19, 2021 14:20
Show Gist options
  • Save jmassardo/646458b15545d306c12931a22285d5dc to your computer and use it in GitHub Desktop.
Save jmassardo/646458b15545d306c12931a22285d5dc to your computer and use it in GitHub Desktop.
Simple Rego rule to exclude certain k8s namespaces
# 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