-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
add oc describe
help suggestion to cmds with --container
option
#10469
add oc describe
help suggestion to cmds with --container
option
#10469
Conversation
oc describe
help suggestion to cmds with --container
option
Looking at the changes required here, this seems like something that should be on the flag. And it doesn't have to be that complex - even just In general on help messages if we have to add a bunch of abstractions it often isn't worth it. |
06e997a
to
e4fa367
Compare
@smarterclayton Thanks for the feedback.
Done! |
e4fa367
to
55bfc49
Compare
[test] |
Much simpler, thanks |
My comment from the upstream pull: You can run these command against things that aren't pods. Why would we give advice that is only valid for a pod? Also, that's a super long description. Can you elaborate on reasoning? The help string as provided is super long, its incorrect, and it seems like most people who have multiple containers in a pod where the first one isn't the one they want would know what they have. |
My reasoning for this was that it might give new users a way to know how to get container names to pass to a command's
Maybe it could be used in one of the usage examples instead? Also, so that it remains consistent with commands that take a resource and not specifically a pod as an argument, maybe it could be rephrased or removed from those? I think another solution to this would be to inform the user how to list pod containers when |
Have you thought about why they get there? It's hard to get there without intentionally creating multiple containers, in which case you know what you're looking for. Having to specify a container without knowing about the container means that there are multiple containers in your podspec-y thing, that the most important one isn't first, and that you didn't define the podspecy thing. |
That is a fair point. |
In practice, people will use this flag only for things that have pods, so On Wed, Aug 17, 2016 at 3:06 PM, Juan Vallejo [email protected]
|
How do they know how to find the container they are looking for? |
But practically, if I don't know about containers, I'll go through a flow like this:
I'm not sure how you make a more helpful description, but when I run |
Most of the places we have -c because the assumption is most of the time On Wed, Aug 17, 2016 at 3:55 PM, Dan McPherson [email protected]
|
If we'd like to try a completely different approach here, one idea would be to make this line an actual Since this is a runtime solution instead of just
|
I think I'd like that better. That would actually help a user find the container they need instead of trying to backtrack through all the layers. |
5fc1ebf
to
2595e56
Compare
@fabianofranz Thanks for the feedback! I have gone ahead and replaced the |
2595e56
to
de2c10a
Compare
[test] |
… names Fixes openshift#10283 Commands with the `--container=` option provide no suggestions to a user on how to obtain a container's name from a pod. This patch adds a suggestion to use `oc describe <pod_name>` as part of the output of `oc exec <pod> <cmd>` ``` $ oc exec database-1-h9dl1 -- /bin/sh -c "echo test" defaulting container name to ruby-helloworld-database, use 'oc describe database-1-h9dl1' to see all containers in this pod test ```
de2c10a
to
377d43d
Compare
@@ -226,7 +226,7 @@ Find more information at https://github.com/kubernetes/kubernetes.`, | |||
cmds.AddCommand(NewCmdUncordon(f, out)) | |||
|
|||
cmds.AddCommand(NewCmdAttach(f, in, out, err)) | |||
cmds.AddCommand(NewCmdExec(f, in, out, err)) | |||
cmds.AddCommand(NewCmdExec("kubectl", f, in, out, err)) |
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.
Indentation looks a little weird here on Github but I'm going to assume it's correct since gofmt didn't catch this.
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.
Thanks for catching this, the gofmt plugin I have did not seem to catch it either. Fixed!
If everyone is ok with the approach, LGTM. |
tagged upstream (though it now needs a rebase), [merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8332/) (Image: devenv-rhel7_4897) |
377d43d
to
bc5afbb
Compare
Evaluated for origin test up to bc5afbb |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8304/) |
[merge] |
Evaluated for origin merge up to bc5afbb |
Fixes #10283
UPSTREAM: kubernetes/kubernetes#30717
This is an alternate fix to reverted PR: #10360
Commands with the
--container=
option provide no suggestions to a useron how to obtain a container's name from a pod.
This patch adds a suggestion to use
oc describe <pod_name>
as part of the output ofoc exec <pod> <cmd>
when<pod>
has more than one container.$ oc exec database-1-h9dl1 -- /bin/sh -c "echo test"
cc @fabianofranz @smarterclayton