Conditionals
Conditionals are the logic layer in Orkestra. They let you express when something should happen — without writing Go code.
A conditional is a when: or or: block attached to a resource, a status field, or a hook. Orkestra evaluates it on every reconcile. If the condition passes, the block runs. If it fails, the block is skipped cleanly — no error, no partial state.
when: — AND semantics
All conditions must pass. If any one fails, the block is skipped.
services:
- name: "{{ .metadata.name }}-public"
type: LoadBalancer
when:
- field: spec.exposePublicly
equals: "true"
- field: spec.environment
equals: "production"
This service is created only when exposePublicly is true and environment is production.
or: — OR semantics
At least one condition must pass.
services:
- name: "{{ .metadata.name }}-svc"
or:
- field: spec.environment
equals: "production"
- field: spec.forceExpose
NotEquals: "true"
The service is created when either condition is true.
Condition operators
String matching (equals, contains, prefix, suffix, regex), existence (exists, notExists), numeric comparison (gt/lt/gte/lte/between), and set membership (in/notIn) are all available, each with a same-named shorthand field so you rarely need operator:/value: explicitly — see the full operator reference.
Where conditionals work
| Location | Effect |
|---|---|
operatorBox.reconcile.when | Entire reconcile cycle is skipped when conditions fail — CRD reports gated |
onCreate, onReconcile, onDelete resources | Resource is created/updated/deleted only when conditions pass |
status.fields entries | Status field is written only when conditions pass |
| Motifs | Conditions apply inside motif templates the same way |
Where to go next
- Resource Conditions — conditional creation for
onCreate,onReconcile,onDelete - Async Reconciliation — multi-phase workflows using
when:gates - Status Conditions — state machines via
when:onstatus.fields - Conditional Reconciliation — pre-reconcile gates via
operatorBox.reconcile.when
Try it
ork init --pack intermediate
cd 05-when-conditions
Follow the README — one CRD, three tiers, different resources at each tier, zero Go code.