Skip to content

Instantly share code, notes, and snippets.

@tommeramber
Created January 5, 2022 11:22
Show Gist options
  • Save tommeramber/bc55d7f63858d371262acbbf18974a97 to your computer and use it in GitHub Desktop.
Save tommeramber/bc55d7f63858d371262acbbf18974a97 to your computer and use it in GitHub Desktop.
Rego Playbook Demo
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