-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Let kubectl run follow rules for --
#13917
Let kubectl run follow rules for --
#13917
Conversation
@smarterclayton @bgrant0607 Could you please review this PR? |
GCE e2e build/test failed for commit b7896da1ff484097fe9cf5a3c87b16dc25e2add3. |
@@ -106,6 +107,23 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob | |||
return cmdutil.UsageError(cmd, "NAME is required for run") | |||
} | |||
|
|||
// Let kubectl run follow rules for `--` | |||
var commandAndCustomArgs []string |
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.
Hrm - this should be implemented by Cobra automatically. Maybe I misunderstand what this is trying to fix?
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.
Nm, I reminded myself. There may be a more succint way to fix this
kubectl run -p POD
should have zero argskubectl exec POD
should have zero argskubectl run POD COMMAND
should have 1 argkubectl run -p POD COMMAND
should have 1 arg
If you use SetInterspersed(true)
on the cobra.Command object, does that give you the correct behavior in all of these cases? (you might have to grab arg[0] for case 3 and shorten args to args[1:])
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.
This commit doesn't fix these cases, it fixes #13004 . And run command hasn't -p operation.
Labelling this PR as size/S |
@smarterclayton This commit fixes #13004 you posted, that is "kubectl run --restart=Never --image=gcr.io/google_containers/busybox --command -- sleep 600 |
@k8s-bot test this please |
GCE e2e build/test failed for commit b7896da1ff484097fe9cf5a3c87b16dc25e2add3. |
I'm trying to understand what we believe the 'syntax' is. These things work today:
But this patch will break 1 and 3... |
--command was added by #12571, which was a 1.1-alpha release, so backward compatibility is not a concern. We should fix the command to be what we want it to be before we cut 1.1 -- so ASAP. |
Could we just eliminate |
cc @kubernetes/kubectl |
|
Nevermind about --command. I see that's a bool. That's fine.
|
@bgrant0607 --command isn't problem, the problem is that -- is useless now, we can't separate NAME and cmd arg1 ... argN, for example, If miss mycontainer, kubectl run --image=busybox --command -- echo -e "\ahello there", echo would become the name. |
@eparis #13004 proposed that your (3) should not work. It's also fine by me if (1) does not work -- that we require How does exec not suffer the same problem? |
@bgrant0607 The exec has the same problem, I point it out in #13004 |
If we have the conclusion, I'd like to fix the same problem in exec. |
@k8s-bot test this please |
GCE e2e build/test failed for commit b7896da1ff484097fe9cf5a3c87b16dc25e2add3. |
@k8s-bot test this again please |
GCE e2e build/test failed for commit b7896da1ff484097fe9cf5a3c87b16dc25e2add3. |
So I personally don't love breaking 1) and think it should continue to work. If the consensus is to force @feihujiang seems like it might be useful if cobra stored len(args) when |
something like: eparis/pflag@b25fea9 |
along with eparis/cobra@edde52e |
I don't like forcing -- either On Sep 16, 2015, at 11:02 AM, Eric Paris notifications@github.com wrote: So git log (and other git like commands) don't allow 3) to work either. I I personally don't love breaking 1) and think it should continue to work. @feihujiang https://github.com/feihujiang seems like it might be useful — |
Sorry for the assign spam, bad github UI on mobile. LGTM |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test failed for commit d1c47c0e79bacc276ad5717dc009df1644fcb4cc. |
@k8s-bot test this please |
GCE e2e test build/test passed for commit d1c47c0e79bacc276ad5717dc009df1644fcb4cc. |
@k8s-bot test this please |
I tested this PR locally, and all tests of unit/integration passed. I don't know why Jenkins unit/integration failing. Who could post the result of Jenkins unit/integration for me? I couldn't get it. Thanks very much. |
GCE e2e build/test failed for commit d1c47c0e79bacc276ad5717dc009df1644fcb4cc. |
I rebased, and found the error. |
e2e failure:
unit/integration failure:
|
d1c47c0
to
4d2333b
Compare
PR changed after LGTM, removing LGTM. |
GCE e2e test build/test passed for commit 4d2333b. |
@smarterclayton I rebased this PR (use fake.CreateHTTPClient), please review again. @janetkuo thanks. |
@smarterclayton Could you please review this PR, this PR is delayed a lot. Thanks! |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit 4d2333b. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
* Removes a todo item from the list * Test coverage provided by kubernetes/kubernetes#13917 * closes openshift#8620
* Removes a todo item from the list * Test coverage provided by kubernetes/kubernetes#13917 * closes openshift#8620
* Removes a todo item from the list * Test coverage provided by kubernetes/kubernetes#13917 * closes openshift#8620
Fixes #13004