-
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 a label command to kubectl. #4237
Conversation
Should this support bulk assignment from day one? Seems like this is the equiv style command as update. |
Yes, it should support bulk assignment. |
|
||
Usage: | ||
``` | ||
kubectl label [--overwrite] <resource> <name> <key-1>=<val-1> ... <key-n>=<val-n> [--resource-version=<version>] [flags] |
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.
We use <id>
for all other commands. We should be consistent, and convert them all to <name>
at some point (soon).
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.
ok, not in this PR ;)
I was thinking about a postfix minus sign for delete. eg. |
If the remove label syntax is acceptable folks, I'll code that up and send this for review. |
How would that work with removing multiple labels? |
@jlowdermilk |
what does bulk update mean in this context? Do we want to support a label query? Do we want to support labeling all resources in a collection? This is kind of unlike update because we don't specify files to relabel. I'd prefer to add bulk update in a separate PR. |
Remove label and bulk update as separate PR sg. LGTM. |
|
Remove implemented. @smarterclayton I 100% agree that it will be a common use case. Promise to do 2 PRs before 1.0 (probably this week):
sg? |
If --overwrite is true, then existing labels can be overwritten, otherwise attempting to overwrite a label will result in an error. | ||
If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used. | ||
|
||
Examples: |
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.
Add remove label example.
SGTM ----- Original Message -----
|
overwrite := util.GetFlagBool(cmd, "overwrite") | ||
resourceVersion := util.GetFlagString(cmd, "resource-version") | ||
|
||
obj, err := updateObject(client, mapping, namespace, name, func(obj runtime.Object) runtime.Object { |
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 didn't see a response to the bulk-update issue.
Example is here:
https://github.com/GoogleCloudPlatform/kubernetes/blob/master/pkg/kubectl/cmd/update.go#L57
Obviously, a resource-version precondition would be incompatible with a bulk update.
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.
Ok, comment didn't show in file view, but saw it in email. I'm fine with a separate PR.
Reassigning to @jlowdermilk since he left comments that still look unresolved. |
fc70e66
to
ac35aa5
Compare
PR updated to document the remove label syntax. |
lgtm |
Add a label command to kubectl.
@bgrant0607 @jlowdermilk @smarterclayton