New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kubectl: exec and attach break scripting and should honor --quiet
#99004
Conversation
62ef450
to
4493ef0
Compare
--quiet
correctly--quiet
--quiet
--quiet
--quiet
--quiet
1924a37
to
46afd41
Compare
/retest |
2 similar comments
/retest |
/retest |
46afd41
to
7ad2688
Compare
/retest |
7ad2688
to
0661332
Compare
018e2b0
to
35097dd
Compare
--quiet means no informational output for the human that could be confused with the output of the shell / command on the other side.
35097dd
to
90bbe47
Compare
The behavior of the container defaulting in attach/exec is inconsistent and should be unified. As a user, when we default the vast majority of pods will have a small number of containers and so printing the container names inline (as kubectl logs did) is more appropriate. The debug message we printed about using describe was already longer than 99% of all pod container names, so we were wasting user time. Unify container selection for exec and attach to be consistent with old behavior. Properly handle the --quiet flag (should not print in that case) for both commands. Remove EnableCmdSuggestion and the machinery it needs. The message now prints: > Defaulted container "etcdctl" out of: etcdctl, etcd, etcd-metrics, etcd-ensure-env-vars (init), etcd-resources-copy (init)
90bbe47
to
43e8ebb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/triage accepted |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: smarterclayton, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
--quiet means no informational output for the human that could be confused with the output of the underlying system. We have been very lax in allowing new debugging messages to be added to exec and attach which breaks scripting (exec and attach are designed to work properly for remote scripting and only error when that error cannot be confused with the remote system). Make exec and attach properly honor --quiet to suppress informational / non-failure output from the local command. We added quiet as an internal option several years back and have been steadily growing less tolerant of flakes (originally exec was a good citizen in almost all cases, now it is less so).
Secondly, attach and exec are inconsistent with how they show the containers the user can exec/attach to. Printing the describe command is a lot of text output (80 characters) and describe itself is pretty bad at telling you container names. The behavior of logs up to this point is more accurate, and since the vast majority of pods have a small number of containers, it would be better for humans to print a single line with all ephemeral and init containers. Update the commands to share similar debugging code (and suppress the defaulting message when --quiet is provided). After this change we no longer need EnableCmdSuggestion:
Example output:
/kind bug
/kind cleanup