feat(mcp): add k8s_logs — pod container logs for k8s-runtime fleets - #157
Merged
Merged
Conversation
deploy_events (ECS control-plane events, archived via EventBridge) has no k8s equivalent and explicitly refuses k8s-runtime fleets — there's no archival system to read because the k8s API serves pod logs directly. Adds a k8s_logs tool built on the kube client k8s_client_for() already wires (list_k8s_contexts/list_namespaces/fleet_config's k8s dispatch): - studio-cp: extract find_k8s_pods() (deployment lookup + live pod list) out of observe_k8s_deployment so both it and the new fetch_k8s_pod_logs() share the same selector logic. fetch_k8s_pod_logs() disambiguates by instance_id (the same pod uid deploy_get/get_agent_states already surface) when more than one pod matches — the shape hit debugging seaturtle's image swap, where a crashed pod sat next to its replacement mid-rollout — and supports `previous` (kubectl logs -p) to read a CrashLoopBackOff pod's last terminated container, since its current log is empty post-restart. - oab-mcp: new k8s_logs tool, dispatched the same way deploy_get/deploy_list require `fleet` for k8s (no bare-cluster k8s path exists for those either). Test plan: - cargo check -p studio-cp, -p oab-mcp: clean - cargo test -p studio-cp/-p oab-mcp --lib: hits the same aws-sdk-ec2 test-cfg OOM on this box PR #153 already documented and deferred to CI (unrelated to this change — cargo check compiles the same code cleanly) 🤖 Generated with Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deploy_events(ECS control-plane events, archived via EventBridge) has no k8s equivalent — it explicitly refuses k8s-runtime fleets. There's no archival system to build for k8s: the k8s API serves pod logs directly.studio-cp: extractedfind_k8s_pods()(deployment lookup + live pod list) out ofobserve_k8s_deploymentso both it and the newfetch_k8s_pod_logs()share the same selector logic instead of duplicating it.fetch_k8s_pod_logs()disambiguates byinstance_id(the same poduiddeploy_get/get_agent_statesalready surface asInstancePhase.id) when more than one pod matches — exactly the shape hit debuggingseaturtle's0.9.0→0.10.0-beta.4image swap, where a crashed pod sat next to its replacement mid-rollout.previous(kubectl logs -p) to read a CrashLoopBackOff pod's last terminated container — its current log is empty post-restart, so this is the only way to see why it died.oab-mcp: newk8s_logstool. Requiresfleetnaming a k8s-runtime fleet, same conventiondeploy_get/deploy_listalready use for their k8s dispatch (no bare-cluster k8s path exists for those either).Context
Found while live-debugging the
seaturtletest agent this session (see #155 for the related — but independent — finding that k8s-runtime agents also have zero ACP network exposure; that's about reaching the pod, this is about reading its logs, which works today via the k8s API regardless of that gap).Test plan
cargo check -p studio-cp -p oab-mcp— cleancargo test -p studio-cp -p oab-mcp --lib— hit the sameaws-sdk-ec2test-cfg OOM on this box that PR fix(console): pin Beta channel to a versioned release, default ACP deploys to it #153 already documented and deferred to CI (unrelated to this change;cargo checkcompiles the same code cleanly). Deferring to CI here too.k8s_logsagainst a live k8s-runtime fleet with a crashed pod, both with and withoutprevious🤖 Generated with Claude Code