1
0
forked from suse-edge/Factory
Factory/metallb-chart/policy/controller.rego

17 lines
595 B
Rego
Raw Normal View History

2024-10-22 09:51:51 +02:00
package main
# validate serviceAccountName
deny[msg] {
input.kind == "Deployment"
serviceAccountName := input.spec.template.spec.serviceAccountName
not serviceAccountName == "release-name-metallb-controller"
msg = sprintf("controller serviceAccountName '%s' does not match expected value", [serviceAccountName])
}
# validate node selector includes builtin when custom ones are provided
deny[msg] {
input.kind == "Deployment"
not input.spec.template.spec.nodeSelector["kubernetes.io/os"] == "linux"
msg = "controller nodeSelector does not include '\"kubernetes.io/os\": linux'"
}