Enrichment Targets

4 min read

Each target fetches one or more secondary Kubernetes objects and embeds them as underscore-prefixed keys on the child map. Notes that read these keys require the corresponding target to be declared.


pods

Embeds _pods — a list of pod summaries — on Deployment, StatefulSet, ReplicaSet, or Job children.

enrich:
  - pods

Each pod summary: {name, ip, phase, ready, node, restartCount, containers}.

Notes unlocked: podCount, readyPodCount, podNames, podIPs, podPhases, podNodes, podMaxRestarts, hasCrashingPod, podCrashLoopDetected, podImagePullBackOffDetected, podOOMKilledDetected, podContainerReasons, and more.

status:
  fields:
    - path: podCount
      value: "{{ podCount .children.deployment }}"
    - path: readyPodCount
      value: "{{ readyPodCount .children.deployment }}"
    - path: hasCrashingPod
      value: "{{ hasCrashingPod .children.deployment }}"
    - path: podMaxRestarts
      value: "{{ podMaxRestarts .children.deployment }}"

Try it:

ork init --pack use-cases
cd enrich/01-pod-health
ork run

events

Embeds _warnings — Kubernetes events filtered to type=Warning — on any child resource.

enrich:
  - events

Each warning: {reason, message, count, lastTimestamp}.

Notes unlocked: hasWarnings, warningCount, firstWarning, firstWarning, firstWarningReason, warningMessages, warningReasons.

status:
  fields:
    - path: hasWarnings
      value: "{{ hasWarnings .children.deployment }}"
    - path: firstWarning
      value: "{{ firstWarning .children.deployment }}"
      when:
        - field: "{{ hasWarnings .children.deployment }}"
          equals: "true"

Best used with a when: gate — events are expensive to fetch and only useful when something is wrong:

enrich:
  - events:
      when:
        - field: "{{ replicasReady .children.deployment }}"
          equals: "false"

Try it:

ork init --pack use-cases
cd enrich/02-warning-events
ork run
kubectl apply -f cr-broken.yaml   # bad image → warning events appear in status

replicasets

Embeds _replicaSets — list of full ReplicaSet objects owned by the Deployment.

enrich:
  - replicasets

Notes unlocked: deploymentReplicaSetCount, deploymentReplicaSets, oldDeploymentReplicaSets.

Useful for surfacing rollout progress — old ReplicaSets still scaling down while the new one scales up.

status:
  fields:
    - path: replicaSetCount
      value: "{{ deploymentReplicaSetCount .children.deployment }}"
    - path: oldReplicaSets
      value: "{{ oldDeploymentReplicaSets .children.deployment }}"

Gate behind rollout detection — zero cost in steady state:

enrich:
  - replicasets:
      when:
        - field: "{{ replicasReady .children.deployment }}"
          equals: "false"

Try it:

ork init --pack use-cases
cd enrich/03-rollout-observer
ork run

owner

Embeds _owner{name, kind, uid} from metadata.ownerReferences — on ReplicaSet children.

enrich:
  - owner

Notes unlocked: replicaSetOwnerName, replicaSetOwnerKind.

status:
  fields:
    - path: ownerDeployment
      value: "{{ replicaSetOwnerName .children.replicaset }}"

endpoints

Embeds _endpoints — list of {ip, port, ready} pairs — on Service children.

enrich:
  - endpoints

Notes unlocked: hasEndpoints, serviceEndpoints, serviceEndpointCount, serviceFirstEndpoint.

status:
  fields:
    - path: hasEndpoints
      value: "{{ hasEndpoints .children.service }}"
    - path: endpointCount
      value: "{{ serviceEndpointCount .children.service }}"
    - path: firstEndpoint
      value: "{{ serviceFirstEndpoint .children.service }}"

pvcs

Embeds _pvcs — list of full PVC objects — on StatefulSet children. PVCs are resolved from volumeClaimTemplates.

enrich:
  - pvcs

Notes unlocked: statefulSetPVCCount.


pvc / pvclaim / persistentvolumeclaim

Embeds _pv — the bound PersistentVolume — on PersistentVolumeClaim children.

enrich:
  - pvc

Notes unlocked: pvcBound, pvcStorageClass, pvcCapacity, pvReclaimPolicy, pvAccessModes.


storageclass / sc

Embeds _storageClass — the full StorageClass object — on PersistentVolumeClaim children.

enrich:
  - storageclass

Notes unlocked: pvcStorageClass (reads from embedded StorageClass).


backingpods

Embeds _backingPods — pod summary list matching spec.selector — on Service children.

enrich:
  - backingpods

Notes unlocked: podCount, readyPodCount, hasCrashingPod (operating on the backing pod set).


node

Embeds _node{name, zone, region, instanceType} — on Pod children.

enrich:
  - node

Notes unlocked: podNode, zone and region topology fields.


hpa / horizontalpodautoscaler

Embeds _currentMetrics and _scaleTarget on HorizontalPodAutoscaler children.

enrich:
  - hpa

Notes unlocked: noteHPAScaling, noteHPAScalingActive, hpaCurrentReplicas, hpaDesiredReplicas.


cronjob / cj

Embeds _activeJobs, _lastJob, and _lastSuccessfulJob on CronJob children.

enrich:
  - cronjob

Notes unlocked: cronJobLastJobName, cronJobLastJobSucceeded, cronJobLastSuccessfulJobName.


ingress / ing

Embeds _loadBalancerIPs and _tlsSecrets on Ingress children.

enrich:
  - ingress

Notes unlocked: ingressLoadBalancerIP, ingressHasLoadBalancer, ingressTLSSecrets.


pv / pvs / persistentvolume

Embeds _pvc — the bound PersistentVolumeClaim — on PersistentVolume children.

enrich:
  - pv

Quick reference

TargetAliasesApplies toEmbedsCost
podspodDeployment, StatefulSet, ReplicaSet, Job_pods1 list-pods
eventswarnings, event, evany_warnings1 list-events
replicasetsDeployment_replicaSets1 list-replicasets
ownerReplicaSet_ownerparsed from metadata
endpointsep, endpointsliceService_endpoints1 list-endpointslices
pvcsStatefulSet_pvcs1 list-pvcs
pvcpvclaim, persistentvolumeclaimPVC_pv1 get-pv
storageclasssc, storageclassesPVC_storageClass1 get-storageclass
backingpodsService_backingPods1 list-pods
nodePod_node1 get-node
hpahorizontalpodautoscalerHPA_currentMetrics, _scaleTarget1 get-hpa
cronjobcj, cronjobsCronJob_activeJobs, _lastJob, _lastSuccessfulJob1-2 gets
ingressing, ingressesIngress_loadBalancerIPs, _tlsSecrets1 get + N gets
pvpvs, persistentvolumePV_pvc1 get-pvc

Next → Conditional Enrichment