Skip to content

feat(agent-lifecycle): k8s RuntimeDriver — projects Pod state onto the 6-state model - #148

Merged
brettchien merged 1 commit into
mainfrom
orca/agent-lifecycle-k8s-driver
Sep 7, 2026
Merged

feat(agent-lifecycle): k8s RuntimeDriver — projects Pod state onto the 6-state model#148
brettchien merged 1 commit into
mainfrom
orca/agent-lifecycle-k8s-driver

Conversation

@brettchien

Copy link
Copy Markdown
Contributor

Summary

studio#146 slice 1 of 4 (k8s fleet roster/observe UI). Adds crates/agent-lifecycle/src/k8s.rs, a RuntimeDriver implementation for k8s mirroring ecs.rs's shape (K8sDriver/K8sPod alongside EcsDriver/EcsTask).

This is a direct port of an already-approved design, not a new decision: docs/adr/agent-lifecycle.md §6's projection table already has a k8s column (drafted alongside ECS's), and crates/oabctl/src/k8s_driver.rs's own module doc explicitly flagged this as deferred work when the k8s ProvisionDriver write path landed (studio#63 slice 3b): "Observing k8s state into the canonical 6-state ... is also out of scope here ... to land as its own follow-up."

Mapping, per the ADR table:

  • Pod phase + readiness → Starting (not yet Ready) / Running (Ready)
  • metadata.deletionTimestamp != null → Stopping (mirrors ECS's desiredStatus STOPPED)
  • Unknown phase (kubelet not reporting / node lost) → Unhealthy(fenced), same treatment as a lost lease
  • CrashLoopBackOff → Unhealthy
  • CP/director cordon → Paused (via accepting_work, unchanged mechanism from ECS)

ready_check_defined mirrors EcsTask::health_check_defined's "no probe ≠ fault" distinction — a pod with no declared readiness probe just hasn't finished starting when ready == false, not a fault.

Only the RuntimeDriver projection lands here — the actual kube::Api<Pod> list/observe call, the oab-mcp roster tool, and the console wiring are separate slices (tracked in #146).

Test plan

  • cargo test -p agent-lifecycle --lib — 20/20 passing (11 existing + 9 new k8s cases, mirroring ecs.rs's table-driven test style)
  • cargo check -p agent-lifecycle — clean
  • Full workspace build/test — left to CI (build-test), not run locally per this sandbox's disk constraints

🤖 Generated with Claude Code

…e 6-state model

studio#146 slice 1. `crates/agent-lifecycle/src/k8s.rs` mirrors `ecs.rs`'s
shape (`K8sDriver`/`K8sPod` alongside `EcsDriver`/`EcsTask`), implementing
`RuntimeDriver` for k8s per the already-approved ADR §6 projection table:
Pod phase + readinessProbe → Starting/Running, `deletionTimestamp != null`
→ Stopping, `Unknown` phase (node lost) or CrashLoopBackOff → Unhealthy.
This is a direct port of an existing design decision, not a new one —
`k8s_driver.rs`'s module doc flagged this exact gap as deferred when the
k8s `ProvisionDriver` write path landed (studio#63 slice 3b).

🤖 Generated with Claude Code
@brettchien
brettchien merged commit 5d9ce31 into main Sep 7, 2026
2 checks passed
@brettchien
brettchien deleted the orca/agent-lifecycle-k8s-driver branch September 7, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant