CEL¶
Common Expression Language (CEL) in Hydra — used for filtering, matching, and extracting dependencies.
Contents¶
- Variables — All available variables by context
- Functions — refBuilder(), id(), clusterEntities(), and more
- Predicates — --include/--exclude filter syntax
- Examples — Practical CEL expression cookbook
Overview¶
CEL (Common Expression Language) is a lightweight expression language used throughout Hydra for:
| Usage | Where |
|---|---|
| Ref-parser predicates | Select which resources a parser applies to |
| Ref-parser pick rules | Extract dependency endpoints |
| CLI filters | --include / --exclude flags |
| Preset predicates | Match infrastructure resources |
| Value predicates | templatePatches, clones, diff, ready, scale |
Quick Start¶
CEL expressions evaluate to true/false (predicates) or lists (ref extraction).
Simple Predicates¶
kind == "Deployment"
ns == "kube-system"
name.startsWith("coredns")
gvk == "apps/v1/Deployment" && ns == "default"
Combining Conditions¶
kind == "Secret" && (ns == "default" || ns == "kube-system")
!(kind == "Event")
namespaced && !appOwned
Accessing Fields¶
has(entity.metadata.annotations) && entity.metadata.annotations["key"] == "value"
entity.spec.replicas > 1
Prerequisites¶
- Concepts: Dependency Graph — Context for how CEL is used
- Refs: Ref Parsers — Primary use of CEL in Hydra