Repository navigation
feat(stack): add stack exec (#179) - #181
Merged
Merged
Conversation
stackctl stack exec <name|id> <chart> [-c CONTAINER] -- COMMAND [ARGS...] runs one command in a container of the stack through the server (GET /api/v1/stack-instances/:id/exec, k8s-stack-manager v0.15.0 or later) and streams its stdout and stderr unchanged. No stdin, no TTY. - The command goes as an argument list in the first message, never in the URL. Header auth only; the stream dial never falls back to ?token=. - Exit codes: the remote exit code; 124 for the server time limit (4001); 130 for Ctrl-C or SIGTERM (a second Ctrl-C exits at once); 255 for an error of stackctl or the server; 1 for invalid flags or arguments. ExitError in cmd/exitcode.go, main.go exits with its code. - --insecure and an http:// URL to a non-loopback host are refused unless --allow-insecure-stream is set (shared with port-forward). - Server text is sanitized; --debug shows the started frame, never output. - A Ctrl-C during the WebSocket handshake now ends the dial at once (closeOnCancel), also for port-forward. - cluster create/update --allow-exec and --allow-port-forward set the per-cluster switches; cluster get shows them. - swagger.json refreshed with the exec route and the cluster switches. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
…reate/update The server needs api_server_url for a cluster with a kubeconfig, and use_in_cluster for the cluster it runs in, but the flags of cluster create could send neither: only --from-file could register a cluster. - create and update: --api-server-url and --use-in-cluster. - create refuses a kubeconfig flag without --api-server-url, and --use-in-cluster with a kubeconfig flag, before any request. - update sends --use-in-cluster=false (the server removes the stored kubeconfig on true). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 #179.
Adds
stackctl stack exec <name|id> <chart> [-c CONTAINER] -- COMMAND [ARGS...]. It runs one command in a container of the stack through the server and streams the output. The route isGET /api/v1/stack-instances/:id/exec(omattsson/k8s-stack-manager#723, #725; first release v0.15.0).Behaviour
--is required. The words after it are the command, sent as a list in the first WebSocket message, never in the URL. There is no shell: use-- sh -c '...'.-oand-qare ignored.124: the server time limit (close 4001)130: Ctrl-C or SIGTERM (a second Ctrl-C exits at once)255: an error of stackctl or the server, with a message on stderr1: invalid flags or argumentsfeature_disabled, plain 404 → upgrade hint), 429, 503, and the closes 1008, 1009, 1011, 4400, 4408 and 4502. stackctl never connects again.cluster create/cluster updateget--allow-execand--allow-port-forward(the per-cluster switches; without them an admin had to use the API).cluster getshows both switches.cluster create/cluster updatealso get--api-server-urland--use-in-cluster. The server needs one of them, but before only--from-filecould send them.createrefuses a kubeconfig flag without--api-server-url, and--use-in-clustertogether with a kubeconfig flag, before any request.Security
?token=.--insecure, and anhttp://API URL to a host other than localhost, are refused before any request unless--allow-insecure-streamis set (shared with port-forward).--debuglogs only thestartedframe, never output or arguments.govulncheckreports nothing.Other changes
closeOnCancel: a Ctrl-C during the WebSocket handshake now ends the dial at once. Before, it could wait up to 45 s; this also affectedstack port-forward.ExitError(cmd/exitcode.go), handled inmain.go.swagger.jsonrefreshed (exec route,exec_enabled, clusterallow_exec/allow_port_forward).Testing
go build,make lint(vet and staticcheck),go test ./...,go test -race -run Exec ./pkg/client ./cmd, contract tests andgovulncheckall pass.feature_disabled); a command over 4096 bytes; a session revoked mid-command--insecurerefused without--allow-insecure-stream;--debugoutput; audit entriesOpen
ExecServerVersionand the upgrade hints against the final v0.15.0 release.🤖 Generated with Claude Code