Created
January 5, 2022 11:22
-
-
Save tommeramber/bc55d7f63858d371262acbbf18974a97 to your computer and use it in GitHub Desktop.
Rego Playbook Demo
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
package play | |
violation[msg] { | |
input.kind == "Service" | |
input.spec.type == "NodePort" | |
msg := "User is not allowed to create service of type NodePort" | |
} | |
### Violation ### | |
{ | |
"apiVersion": "v1", | |
"kind": "Service", | |
"metadata": { | |
"name": "my-service" | |
}, | |
"spec": { | |
"type": "NodePort", | |
"selector": { | |
"app": "MyApp" | |
} | |
} | |
} | |
### non-Violent ### | |
{ | |
"apiVersion": "v1", | |
"kind": "Service", | |
"metadata": { | |
"name": "my-service" | |
}, | |
"spec": { | |
"type": "lol", | |
"selector": { | |
"app": "MyApp" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment