Kubernetes Notes
Kubernetes notes safely navigate the unstructured objects that Orkestra exposes through the template context — especially child resources available under .children.* and cross-CRD observations under .cross.*.
Reference
| Note | Description |
|---|---|
meta | Return the metadata map of a Kubernetes object. |
labels | Return the `metadata. |
annotations | Return the `metadata. |
spec | Return the spec map of a Kubernetes object. |
status | Return the status map of a Kubernetes object. |
phase | Return `status. |
get | Navigate a nested path through a Kubernetes object using variadic string segments. |
ownerKind | Return the kind of the first ownerReference. |
ownerName | Return the name of the first ownerReference. |
hasCondition | Return true if `status. |
conditionReason | Return the reason field of a named condition. |
conditionMessage | Return the message field of a named condition. |
resourceExists | Return true when the object is a non-nil map[string]interface{}. |
isTerminating | Return true when `metadata. |
generation | Return `metadata. |
observedGeneration | Return `status. |
isSynced | Return true when `metadata. |
resourceCPU | Return `spec. |
resourceMemory | Return `spec. |
Examples
# meta
# value: "{{ meta .children.cronjob }}"
# Useful as an intermediate value when chaining with mapGet:
# value: "{{ mapGet (meta .children.cronjob) \"resourceVersion\" }}"
# labels
# value: "{{ mapGet (labels .children.deployment) \"app\" }}"
# {app: frontend, tier: web} → "frontend"
# annotations
# value: "{{ mapGet (annotations .children.deployment) \"orkestra.io/phase\" }}"
# spec
# value: "{{ mapGet (spec .children.cronjob) \"schedule\" }}"
# Equivalent to: .children.cronjob.spec.schedule
# status
# value: "{{ mapGet (status .children.deployment) \"readyReplicas\" }}"
# Equivalent to: .children.deployment.status.readyReplicas
# phase
# value: "{{ phase .children.pod }}"
# → "Running", "Pending", "Succeeded", "Failed", or ""
# when:
# - field: "{{ phase .children.pod }}"
# equals: "Running"
# get
# value: "{{ get .children.cronjob \"status\" \"lastScheduleTime\" }}"
# value: "{{ get .children.deployment \"spec\" \"template\" \"spec\" \"containers\" }}"
# ownerKind
# value: "{{ ownerKind .children.replicaset }}"
# → "Deployment"
# ownerName
# value: "{{ ownerName .children.replicaset }}"
# → "my-app"
# hasCondition
# value: "{{ hasCondition .children.deployment \"Available\" }}"
# Standard types: Available, Progressing, Degraded, Ready, Complete
# conditionReason
# value: "{{ conditionReason .children.deployment \"Available\" }}"
# → "MinimumReplicasAvailable" or ""
# conditionMessage
# value: "{{ conditionMessage .children.deployment \"Progressing\" }}"
# → "ReplicaSet has successfully progressed." or ""
# resourceExists
# value: "{{ resourceExists .children.deployment }}"
# Gate dependent resources on child existence:
# when:
# - field: "{{ resourceExists .children.secret }}"
# equals: "true"
# isTerminating
# Gate traffic routing away from terminating pods:
# when:
# - field: "{{ isTerminating .children.deployment }}"
# equals: "false"
# generation
# value: "{{ generation .children.deployment }}"
# → 3
# observedGeneration
# value: "{{ observedGeneration .children.deployment }}"
# → 3
# isSynced
# Gate dependent resources on rollout completion:
# when:
# - field: "{{ isSynced .children.deployment }}"
# equals: "true"
status:
fields:
- path: lastScheduleTime
value: "{{ get .children.cronjob \"status\" \"lastScheduleTime\" }}"
- path: deploymentReady
value: "{{ hasCondition .children.deployment \"Available\" }}"
- path: phase
value: "{{ phase .children.pod }}"
when:
- field: "{{ isSynced .children.deployment }}"
equals: "true"
- field: "{{ resourceExists .children.secret }}"
equals: "true"
# resourceCPU
# normalize block — default resource requests without nil pointer panics
normalize:
spec:
resources.requests.cpu: '{{ resourceCPU . | default "100m" }}'
resources.requests.memory: '{{ resourceMemory . | default "128Mi" }}'
# resourceMemory
- path: memoryRequest
value: "{{ resourceMemory .children.deployment }}"