What you can do with it
The same shape of policy for every step of the lifecycle of an object.
Validate
Reject an object before it is stored, or let it through with a warning.
Mutate
Fill in what nobody should have to remember: default labels, resource limits, annotations, pull secrets.
Generate
Create what has to exist because something else exists: the quota of a new namespace, its default ConfigMap, a Secret derived from another one.
Cleanup Soon
Delete what a policy wrote. The objects that outlive their source are next.
Clone Soon
Copy an object into another namespace, or into another resource.
Reasons to love it
Most policy engines give you one way to write a rule, and a fixed idea of what a rule can see. Neither fits a cluster that changes shape every day.
The rule decides the syntax
Some rules read better as a program, some as a single expression, and many need another object in the cluster to decide. Admitik ships five engines in the core, so each rule is written the way it fits and one policy can use a different engine for every condition, patch and message.
The context comes with it
All of them receive the same thing: the object, its previous state, the resources the policy asked for and the values left by earlier conditions.
CEL expressions
A field, a comparison, a set of labels. The rule that fits in one line.
object.spec.replicas <= 10Starlark code
Loops and helper functions, for the rules that are a program.
for c in object.spec.containers:Go templates templates
Manifests and messages built from the fields of an object.
{{ .object.metadata.name }}Plain text
Text that never changes.
configmaps are not allowed herePlain + CEL text and values
Text with holes, filled from the object.
namespace: {{cel: object.metadata.name }}