Skip to content

CICD-370 · Kyverno policy validation ​

Encyclopedia · Advanced security and compliance · All snippets

Previous · CICD-369 · Next · CICD-371

1. Where it fits ​

  • Placement CI policy test.
  • Prerequisites reviewed policies, a short-lived CI identity, and synthetic or approved test inputs.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
kyverno apply policy/require-nonroot.yaml --resource tests/deployment.yaml

3. How it works ​

Kyverno evaluates the policy against the supplied resource fixture. Include a failing fixture to prove the match is active.

4. Verify the result ​

Keep a separate known-bad fixture under kyverno test so the policy cannot silently stop matching.

Validation syntax-validated (Bash parse). Status definitions.