Repository navigation
fix(stack): show the exec hint only on the pod that stack exec picks (#186) - #188
Merged
Merged
Conversation
…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>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
There was a problem hiding this comment.
🟢 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
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.
Closes #186.
Problem
stack podsshowed 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
stack exec -c <name>picks: the first pod by name that is Running, has the Ready conditionTrueand runs the container. This is the server rule.-.docs/commands.mddescribe the column per pod and state the limits.-qoutput 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
TestExecColumn: pod without the container, Succeeded Job pod, not-ready pod, Pending and Failed pods, Ready conditionUnknown, two Ready pods, containers on different pods, an init container of the same name, and no hints.TestStackPodsCmd_ExecHintsUnplacedcovers the line under the table.go vet ./...,go test ./...andmake lintpass.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:
Before the change, every row showed
app*, worker.stack exec web,-c appand-c workerall ran inweb-f4885878f-k2cxp.🤖 Generated with Claude Code