Test policies offline with gator

Test templates and constraints against fixtures without a cluster, so policy mistakes show up in CI before deploy.

gator test -f policy/ && gator verify ./suite

tool
opa-gatekeeper3 commands
tags
opa-gatekeepercisecuritytroubleshooting

More opa-gatekeeper commands

  • kubectl get constrainttemplates && kubectl get constraints -A

    Show all ConstraintTemplates and every constraint created from them in all namespaces.

  • kubectl get k8srequiredlabels <name> -o jsonpath='{.status.totalViolations} {range .status.violations[*]}{"\n"}{.kind}/{.name}: {.message}{end}'

    Read the violation count and offending resources from the constraint's audit status, no new scan needed.

all 3 opa-gatekeeper commands