
CEL expressions are evaluated inside the API server: they are not compiled Go code and they do not call your operator. You can use CEL to write concise, declarative checks against the incoming object.

- Policy: defines match criteria and the CEL expressions (rules) that must evaluate true.
- Binding: enables a policy and chooses the enforcement action (deny, warn, audit).

- For a custom resource like a webapp, match typically targets API group
webapp.cloudnative.space, versionv1, and kindWebApp(orwebappdepending on your CRD). - Inside a CEL expression, use the built-in
objectvariable to read the incoming object (for exampleobject.spec.imageorobject.spec.replicas). - Use
has(...)to test for optional fields before evaluating them.
Examples above show typical, object-local validations that CEL is designed for.
Two short CEL examples:
deny: blocks requests that fail the CEL check.warn: allows the request but surfaces a warning to clients.audit: records violations (useful for monitoring and rollout).
warn or audit when introducing a new policy to observe cluster impact before switching to deny.

Do not use CEL for checks that require external API calls, side effects, or complex business logic. For those cases, implement a custom validating webhook or another admission design that can perform network calls and richer processing.

- CEL spec: https://github.com/google/cel-spec
- Kubernetes Admission Controllers overview: https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/
- ValidatingAdmissionPolicy docs: https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#validatingadmissionpolicy