Last active
January 11, 2019 18:25
-
-
Save sbueringer/a5b755a6db50d0f52ea6a2c8f1998445 to your computer and use it in GitHub Desktop.
This file contains 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
package authorization | |
import data.k8s.matches | |
deny[{ | |
"id": "pods-kube-system", | |
"resource": { | |
"kind": kind, | |
"namespace": namespace, | |
"name": name, | |
}, | |
"resolution": {"message": "Your're not allowed to create/update/delete pods in kube-system"}, | |
}] { | |
matches[[kind, namespace, name, resource]] | |
not re_match("^(system:kube-controller-manager|system:kube-scheduler)$", resource.spec.user) | |
resource.spec.resourceAttributes.namespace = "kube-system" | |
resource.spec.resourceAttributes.resource = "pods" | |
re_match("^(create|update|delete|deletecollections)$", resource.spec.resourceAttributes.verb) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment