-
Notifications
You must be signed in to change notification settings - Fork 40k
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 kubectl create [SUBCOMMAND] pattern #16028
Conversation
Labelling this PR as size/XXL |
So |
@pmorie - yes,
|
+1 to that |
GCE e2e test build/test passed for commit 9e089f96593cdd3e4a3c773ef29ce60b71ddb315. |
I prefer this pattern. It does read better and is more in line with our other commands. When I suggested using secret in #4822, it was as a verb, not as a concept area.
Where there are more familiar verbs (run, expose, autoscale), we should keep them, especially where, as with run, they don't create resources of just a single type. |
This is also similar to what I proposed here: |
@bgrant0607 - ack, will pursue completing this PR, add tests, etc. |
Wow, 3 verbs just to create something. That won't confuse users at all |
How do I create something that is an aggregate of multiple types of things? I.e. a generator that creates several things? |
I must be missing the distinction between new and make. Is it about input or output? I'm going to want to look at the output of new and make as YAML (without creating on the server a lot), so I don't think the fact that new is about an editor makes sense. I'd rather have -o editor. And what sort of templates are new? |
@smarterclayton - I am going to abstain from noun-verb / verb-verb discussions. In OpenShift alone, we have 4 different commands to create a secret depending upon the type of secret as a result of wanting to scope flag proliferation. Trying to do it all in new seems like the worst possible scenario for flag proliferation issues. So it seems at a given, there are some resource types that have common enough usage scenarios for 4 different variations of porcelain commands where If you want to blend
I agree that I think describing I am tired of going back and forth. /cc @DirectXMan12 |
As alternative based on in-person discussions with @smarterclayton , I am fine with:
So basically, macros become sub-commands of Wait for closure before proceeding. UPDATED with macro examples for many other objects |
Some discussions with Derek. There are several ways to create things
A new user, coming to Kube or OpenShift, opens the CLI and tries to find the familiar command that begins their path. If they haven't gotten a hint ahead of time (run or new-app), they'll probably likely gravitate to something like create. Create is not a novice end-user concept. It is a high skill concept. New is not much better. The ideal case for most new Kube users is "run", and for OpenShift is "new-app". We'll probably need to change "new-app" to something in the future, but it represents our introduction verb (go from source to production). I'd rather not have both "create" and "make", because the distinction between them is arbitrary and will distract users. Create is the lowest verb, but Make is only slightly above it. |
Edited comment |
I am eager to use this, whether we go with 'create' or 'make' or 'new' (I don't know what new does). I think new users or relative novices will often think "what was that command again..." and run Can we fold new into this? @ghodss because of historical interest :) |
Also, do we have precedent for |
@thockin we have precedent for key=value syntax for kubectl run |
If @bgrant0607 acks with an ok that resource macros become subcommand of create , I will finish this up tomorrow and do the initial implement of secret and namespace and move on :-) |
Or "-o editor" On Oct 21, 2015, at 8:22 PM, Tim Hockin notifications@github.com wrote: I am eager to use this, whether we go with 'create' or 'make' or 'new' (I I think new users or relative novices will often think "what was that Can we fold new into this? kubectl create --edit namespace = take all the @ghodss https://github.com/ghodss because of historical interest :) — |
I literally lol'd reading this. +1 |
cc @janetkuo |
Regardless what we do, we're going to need good documentation, with examples. I'm fine with adding sub-behaviors to I'd rather use The main difference, though, for Still catching up on the other comments. |
Aggregate of multiple things, like run: custom command. Don't use resource-specific commands like create/make/new/whatever. |
We should try to make all variants of currently accepted resource names (e.g., svc) work as subcommands, and not introduce new ones (e.g., persistent-volume) if we follow that approach. |
@deads2k - still wrapping up the |
return f.PrintObject(cmd, obj, out) | ||
} | ||
|
||
useShortOutput := options.OutputFormat == "name" |
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 is always false
because you checked for ""
above, right?
GCE e2e test build/test passed for commit cab6a17f2acbbffe275b7263fadc67247175920b. |
cab6a17
to
2bc3a5e
Compare
2bc3a5e
to
c438594
Compare
# Pre-condition: only the "default" namespace exists | ||
kube::test::get_object_assert 'namespaces' "{{range.items}}{{$id_field}}:{{end}}" 'default:' | ||
# Command | ||
kubectl create namespace other |
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.
I'd choose a different name, since the next test is expecting that namespace "other" doesn't exist.
a couple comments on |
GCE e2e test build/test passed for commit 2bc3a5e0414db3531971780dba3ecc7cc7ada2a1. |
GCE e2e test build/test passed for commit c438594a3e593907f1ae896639e483004e6e0a1a. |
c438594
to
5e09485
Compare
@deads2k - last two updates addressed, PTAL |
lgtm |
GCE e2e test build/test passed for commit 5e09485. |
@k8s-bot - test this |
@k8s-bot unit test this |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit 5e09485. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
Fixes #4822
UPDATED TO ALIGN WITH CURRENT PR STATUS
The PR now supports the following:
Create
Create namespace
Create a namespace with the specified name. Usage: kubectl create namespace NAME [--dry-run] [flags] Aliases: namespace, ns Examples: # Create a new namespace named my-namespace $ kubectl create namespace my-namespace
Create secret
Create a secret that is generic
Create secret for use with docker registry
EDITED: To reflect latest state of commit as of 12/14/15