kubectl-ate: keep client-go unhandled-error reports off stderr#540
Open
Yiqing Wang (YQ-Wang) wants to merge 1 commit into
Open
kubectl-ate: keep client-go unhandled-error reports off stderr#540Yiqing Wang (YQ-Wang) wants to merge 1 commit into
Yiqing Wang (YQ-Wang) wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
2 tasks
Yiqing Wang (YQ-Wang)
force-pushed
the
fix/issue-26-client-error-output
branch
from
July 25, 2026 09:22
84a2c08 to
c5fabcb
Compare
client-go reports problems it cannot return to a caller through utilruntime.HandleError. Its default handler writes them to the user's terminal naming the client-go file that failed, for example: E0520 15:40:33.154830 3507355 portforward.go:502] "Unhandled Error" err="..." Someone running `kubectl ate create actor` cannot act on that, and the port-forwarding it refers to is an implementation detail of this plugin. Route that channel through the CLI: dropped by default, printed under --verbose. klog is left alone so that warnings a user can act on, such as a missing kubeconfig or an exec credential plugin that failed to refresh, still reach them. Fixes agent-substrate#26
Yiqing Wang (YQ-Wang)
force-pushed
the
fix/issue-26-client-error-output
branch
from
July 25, 2026 09:29
c5fabcb to
7ed1c66
Compare
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.
Fixes #26
Summary
A successful
kubectl ate create actorcan print this:The user never asked for port-forwarding — it is an implementation detail of this plugin — so a message naming
portforward.gois not something they can act on.client-go reports problems it cannot return to a caller through
utilruntime.HandleError, whose default handler writes to stderr. This replaces that handler forkubectl-ate: those reports are dropped by default and printed under a new--verboseflag. klog is deliberately left alone, so warnings a user can act on directly — a missing kubeconfig, an exec credential plugin that failed to refresh — keep reaching the terminal. That is enough because every port-forward error that reaches a user goes throughHandleError, while the package's direct klog calls are allV(4)or higher.#539 proposes removing the localhost hop that produces this particular reset. That is a ~200 line transport change for one message, though, and the next
HandleErrorcall inside client-go would read just as strangely. Handling it here covers the class and leaves #539 to be weighed on its own merits.Notes for reviewers
kubectl-atemakes one-shot RPCs today, so nothing actionable is lost, but a watch-based command should revisit this.--verboserather than--v=Nbecause-vis already cobra's--versionshorthand here, and this does not wire klog verbosity. Happy to match that or the server binaries'--log-levelif you prefer.Validation
go test -race -count=5 ./cmd/kubectl-ate/...and thehack/verifyscripts pass, with no changes togo.modorvendor/modules.txt. New tests assert the exact text from #26 produces no output by default and is printed under--verbose, and the flag is documented in the CLI README.The reset in #26 is timing-dependent and did not reproduce on macOS in 1,500 invocations against a kind cluster, so I forced the same code path by pointing the forwarder at a port with nothing listening. On
main:With this change only the second line is printed, and
--verboserestores the first. Aklog.Warningraised with the quiet handler installed still reaches stderr, and normal commands and error paths are identical tomain.