Skip to content

fix(stack): show the exec hint only on the pod that stack exec picks (#186) - #188

Merged
omattsson merged 1 commit into
mainfrom
fix/stack-pods-exec-hint-per-pod
Nov 5, 2026
Merged

omattsson merged 1 commit into
mainfrom
fix/stack-pods-exec-hint-per-pod

Conversation

@omattsson

Copy link
Copy Markdown
Owner

Closes #186.

Problem

stack pods showed the exec hint of a chart on every pod row of the chart. Finished Job pods, pods that are not ready and pods without the container also got the hint.

Change

  • Each container shows only on the pod that stack exec -c <name> picks: the first pod by name that is Running, has the Ready condition True and runs the container. This is the server rule.
  • All other rows show -.
  • A pod without a Ready condition is not ready, as on the server.
  • A hinted container that no listed pod gets is shown on a line under the table, so the name does not disappear.
  • The help text and docs/commands.md describe the column per pod and state the limits.
  • JSON, YAML and -q output do not change.

Known limits

The pods API does not send the deletion state of a pod and does not mark init containers. A pod that is shutting down, or an init container with the name of an exec container, can still get the hint. A server change that sends the chosen pod for each container fixes this.

Tests

  • New table-driven TestExecColumn: pod without the container, Succeeded Job pod, not-ready pod, Pending and Failed pods, Ready condition Unknown, two Ready pods, containers on different pods, an init container of the same name, and no hints.
  • New TestStackPodsCmd_ExecHintsUnplaced covers the line under the table.
  • go vet ./..., go test ./... and make lint pass.

Live check against a k8s-stack-manager v0.16.1 demo in a kind cluster, with a chart that has two replicas, a pod without the container, a not-ready pod and a finished Job pod:

CHART  POD                          PHASE      READY  ...  EXEC
web    web-aux-64f9b4ccbf-7p9hx     Running    1/1    ...  -
web    web-broken-69965858cf-8jv2l  Running    0/1    ...  -
web    web-f4885878f-k2cxp          Running    2/2    ...  app*, worker
web    web-f4885878f-zbbzj          Running    2/2    ...  -
web    web-migrate-5mnxk            Succeeded  0/1    ...  -

Before the change, every row showed app*, worker. stack exec web, -c app and -c worker all ran in web-f4885878f-k2cxp.

🤖 Generated with Claude Code

…186)

The EXEC column of `stack pods` showed the exec hints of a chart on every
pod row, also on finished Job pods, pods that are not ready and pods
without the container. Each container now shows only on the first pod by
name that is Running and Ready and runs it, as the server picks the pod
for `stack exec -c`. All other rows show "-". A pod without a Ready
condition is not ready, as on the server. A hinted container that no
listed pod gets is shown on a line under the table. JSON and YAML output
are unchanged.

Known limit: the pods API sends no deletion state and does not mark init
containers, so a pod that is shutting down or an init container with the
name of an exec container can still get the hint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 15:10
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the per-pod exec hint changes.

No open issues 🎉

What changed in this PR

Updates stack pods to address #186 by showing each exec hint only on the pod that stack exec would select, rather than every pod in the chart.

Changes:

  • Assigns each container hint to the first eligible Running and Ready pod by name, with unmatched hints shown below the table.
  • Expands tests for pod selection, readiness, container matching, and unmatched hints.
  • Documents the per-pod EXEC column and API limitations while preserving JSON, YAML, and quiet output.
File Description
docs/​commands.md Explains per-pod exec hints and their limitations.
cli/​cmd/​stack_inspect.go Selects eligible pods for exec hints and updates command help.
cli/​cmd/​stack_inspect_test.go Covers hint placement, readiness edge cases, and output behavior.

Review effort: Balanced

@omattsson
omattsson merged commit c62d08a into main Nov 5, 2026
9 checks passed
@omattsson
omattsson deleted the fix/stack-pods-exec-hint-per-pod branch November 5, 2026 15:22
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.

stack pods: EXEC column shows the chart hint on every pod row

2 participants