Conditionals

2 min read

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 anyOf: 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.


Where conditionals work

LocationEffect
onCreate, onReconcile, onDelete resourcesResource is created/updated/deleted only when conditions pass
status.fields entriesStatus field is written only when conditions pass
MotifsConditions apply inside motif templates the same way

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.


anyOf: — OR semantics

At least one condition must pass.

services:
  - name: "{{ .metadata.name }}-svc"
    anyOf:
      - field: spec.environment
        equals: "production"
      - field: spec.forceExpose
        equals: "true"

The service is created when either condition is true.


Condition operators

OperatorMeaning
equalsExact string match (default)
notEqualsString mismatch
containsSubstring match
prefixStarts with
suffixEnds with
existsField is non-empty
notExistsField is absent or empty
gtNumerically greater than
ltNumerically less than
inMember of comma-separated list

Where to go next


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.