Kubernetes Notes

2 min read

Safe traversal and inspection of Kubernetes objects. All notes accept map[string]interface{} — the unstructured form that Orkestra injects for child resources via .children.*.


NoteSignatureReturns
getobj interface{}, keys ...stringinterface{} — safe deep traversal
metaobjmap[string]interface{} — metadata block
nameobjstring
namespaceobjstring
labelsobjmap[string]interface{}
annotationsobjmap[string]interface{}
specobjmap[string]interface{}
statusobjmap[string]interface{}
phaseobjstring
- path: lastScheduleTime
  value: "{{ get .children.cronjob \"status\" \"lastScheduleTime\" }}"

- path: childLabels
  value: "{{ labels .children.deployment }}"

Metadata fields

Direct accessors for the most common metadata fields.

NoteSignatureReturns
resourceNameobjstring
resourceNamespaceobjstring
resourceUIDobjstring
resourceVersionobjstring (etcd revision)
creationTimestampobjstring (RFC3339)
- path: childUID
  value: "{{ resourceUID .children.deployment }}"

Owner references

NoteSignatureReturns
ownerKindobjstring — kind of the first owner
ownerNameobjstring — name of the first owner

Conditions

Kubernetes conditions follow the standard type/status/reason/message structure.

NoteSignatureReturns
hasConditionobj, type stringbool — condition exists with status: "True"
conditionReasonobj, type stringstring
conditionMessageobj, type stringstring
- path: deploymentReady
  value: "{{ hasCondition .children.deployment \"Available\" }}"

- path: deploymentMessage
  value: "{{ conditionMessage .children.deployment \"Progressing\" }}"

when:
  - field: "{{ hasCondition .children.deployment \"Available\" }}"
    equals: "true"

Lifecycle

NoteSignatureReturns
resourceExistsobjbool — object has been created
isTerminatingobjbool — deletion timestamp is set
generationobjint64
observedGenerationobjint64
isSyncedobjboolgeneration == observedGeneration
when:
  - field: "{{ isSynced .children.deployment }}"
    equals: "true"
  - field: "{{ isTerminating .children.deployment }}"
    equals: "false"