ββββββ βββ βββββββββββββββββββ βββββββ ββββ ββββββββββββ βββββββββββββββββββ
βββββββββββ βββββββββββββββββββββββββββββββββ βββββββββββββ βββββββββββββββββββ
βββββββββββ ββ βββββββββ βββββββββββ ββββββββββββββββββββ βββ ββββββ βββ
ββββββββββββββββββββββββ βββββββββββ ββββββββββββββββββββ βββ ββββββ βββ
βββ βββββββββββββββββββββββββββββββββββββββββ βββ βββββββββββ ββββββββββββββββββββββββ
βββ βββ ββββββββ ββββββββββββββββ βββββββ βββ βββββββββββ ββββββββββββββββββββββββ
The Common Expression Language (CEL) is a simple language built on protocol buffer types. CEL can be used on its own, or embedded into a larger product.
Popular products that implemented CEL support:
- Envoy RBAC
- Caddy server standard matcher
- Kubernetes validation and policy rules
- KrakenD conditional requests and responses
- Cloud Firestore / Cloud Storage security rules
CEL evaluates expressions that are similar to single-line functions or lambda expressions. While CEL is commonly used for boolean decisions, it can also be used to construct more complex objects like JSON or protobuf messages.
Here are some CEL syntax examples:
CEL Expression | Purpose |
---|---|
names.isSorted() |
Verify that a list of names is kept in alphabetical order |
items.map(x, x.weight).sum() == 1.0 |
Verify that the "weights" of a list of objects sum to 1.0 |
lowPriorities.map(x, x.priority).max() < highPriorities.map(x, x.priority).min() |
Verify that two sets of priorities do not overlap |
names.indexOf('should-be-first') == 1 |
Require that the first name in a list is a specific value |
- cel-go - Go implementations of CEL
- cel-c - C implementations of CEL
- cel-java - Java implementations of CEL
- cel-python - Python implementations of CEL
- cel-rust - Rust implementations of CEL
- CEL-Go Codelab - a codelab for developers who would like to learn CEL in order to use services that already support CEL
- cel-spec - Common Expression Language specification
- vscode-cel - CEL support for Visual Studio Code
- CEL Playground - an interactive WebAssembly (Wasm) powered environment to explore and experiment with the CEL
- Webhook Fatigue? You're Not Alone: Introducing the CEL - overview of Kubernetes 1.23 CEL support for simplifying CRD validation and reducing reliance on webhooks for extensibility
- Common Expression Language in Kubernetes - the Common Expression Language in Kubernetes API
- validating-admission-policy - Policy local testing guide and valuable resources for Kubernetes Validation Admission