Menu

1 / 5

Kyverno CLI and conftest in CI vs Kyverno at admission

DEV Community: kubernetes·Moep90·10 days ago
#XQaiYnyv
#devtokubernetes#devto#dev#kyverno#policy
Long article (2679 words) — no AI summary yet.
Reading 0:00
15s threshold

Kapitan compiles an inventory

into plain YAML under compiled/ . The registry's compile diff action shows

a reviewer what a pull request changes in that YAML. It does not say

whether the change is allowed. A container that runs privileged or an

image on the tag latest is one line in the diff, and Kapitan compiles it

without an error. Kyverno as an admission controller can reject such an

object when it reaches the cluster, after the merge.

This post runs two policy tools on compiled/ in the pull request: the

Kyverno CLI with policies from

kyverno/policies , and conftest with

Rego rules of your own. It then installs Kyverno into a

kind cluster with the same policies and sends it the

same objects.

The project is

policy-checks

in kadet-hub/examples. Its check script runs the steps below on every

change and once a week, and fails when one of their results changes.

Two targets

The class web renders podinfo as a Deployment with a Service through

the kubernetes generator.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.