Kubectl label command accepts a filename param

This commit is contained in:
feihujiang
2015-08-05 11:43:48 +08:00
parent a6148e79c3
commit 4b9afc516e
6 changed files with 89 additions and 6 deletions

View File

@@ -26,6 +26,10 @@ If \-\-resource\-version is specified, then updates will use this resource versi
\fB\-\-all\fP=false
select all resources in the namespace of the specified resource types
.PP
\fB\-f\fP, \fB\-\-filename\fP=[]
Filename, directory, or URL to a file identifying the resource to update the labels
.PP
\fB\-h\fP, \fB\-\-help\fP=false
help for label
@@ -176,6 +180,9 @@ $ kubectl label \-\-overwrite pods foo status=unhealthy
# Update all pods in the namespace
$ kubectl label pods \-\-all status=unhealthy
# Update a pod identified by the type and name in "pod.json"
$ kubectl label \-f pod.json status=unhealthy
# Update pod 'foo' only if the resource is unchanged from version 1.
$ kubectl label pods foo status=unhealthy \-\-resource\-version=1

View File

@@ -45,7 +45,7 @@ If --overwrite is true, then existing labels can be overwritten, otherwise attem
If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used.
```
kubectl label [--overwrite] TYPE NAME KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]
kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]
```
### Examples
@@ -60,6 +60,9 @@ $ kubectl label --overwrite pods foo status=unhealthy
# Update all pods in the namespace
$ kubectl label pods --all status=unhealthy
# Update a pod identified by the type and name in "pod.json"
$ kubectl label -f pod.json status=unhealthy
# Update pod 'foo' only if the resource is unchanged from version 1.
$ kubectl label pods foo status=unhealthy --resource-version=1
@@ -72,6 +75,7 @@ $ kubectl label pods foo bar-
```
--all[=false]: select all resources in the namespace of the specified resource types
-f, --filename=[]: Filename, directory, or URL to a file identifying the resource to update the labels
-h, --help[=false]: help for label
--no-headers[=false]: When using the default output, don't print headers.
-o, --output="": Output format. One of: json|yaml|template|templatefile|wide.
@@ -116,7 +120,7 @@ $ kubectl label pods foo bar-
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra at 2015-08-12 23:41:01.309176995 +0000 UTC
###### Auto generated by spf13/cobra at 2015-08-13 02:21:16.349210188 +0000 UTC
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_label.md?pixel)]()