Skip to content
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

Implement kubectl annotation update command #11779

Merged
merged 1 commit into from
Aug 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions contrib/completions/bash/kubectl
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,32 @@ _kubectl_label()
must_have_one_noun=()
}

_kubectl_annotate()
{
last_command="kubectl_annotate"
commands=()

flags=()
two_word_flags=()
flags_with_completion=()
flags_completion=()

flags+=("--all")
flags+=("--help")
flags+=("-h")
flags+=("--no-headers")
flags+=("--output=")
two_word_flags+=("-o")
flags+=("--output-version=")
flags+=("--overwrite")
flags+=("--resource-version=")
flags+=("--template=")
two_word_flags+=("-t")

must_have_one_flag=()
must_have_one_noun=()
}

_kubectl_config_view()
{
last_command="kubectl_config_view"
Expand Down Expand Up @@ -978,6 +1004,7 @@ _kubectl()
commands+=("stop")
commands+=("expose")
commands+=("label")
commands+=("annotate")
commands+=("config")
commands+=("cluster-info")
commands+=("api-versions")
Expand Down
1 change: 1 addition & 0 deletions docs/man/man1/.files_generated
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
kubectl-annotate.1
kubectl-api-versions.1
kubectl-attach.1
kubectl-cluster-info.1
Expand Down
197 changes: 197 additions & 0 deletions docs/man/man1/kubectl-annotate.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
.TH "KUBERNETES" "1" " kubernetes User Manuals" "Eric Paris" "Jan 2015" ""


.SH NAME
.PP
kubectl annotate \- Update the annotations on a resource


.SH SYNOPSIS
.PP
\fBkubectl annotate\fP [OPTIONS]


.SH DESCRIPTION
.PP
Update the annotations on one or more resources.

.PP
An annotation is a key/value pair that can hold larger (compared to a label), and possibly not human\-readable, data.
It is intended to store non\-identifying auxiliary data, especially data manipulated by tools and system extensions.
If \-\-overwrite is true, then existing annotations can be overwritten, otherwise attempting to overwrite an annotation 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.

.PP
Possible resources include (case insensitive): pods (po), services (svc),
replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs),
limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc),
resourcequotas (quota) or secrets.


.SH OPTIONS
.PP
\fB\-\-all\fP=false
select all resources in the namespace of the specified resource types

.PP
\fB\-h\fP, \fB\-\-help\fP=false
help for annotate

.PP
\fB\-\-no\-headers\fP=false
When using the default output, don't print headers.

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output format. One of: json|yaml|template|templatefile|wide.

.PP
\fB\-\-output\-version\fP=""
Output the formatted object with the given version (default api\-version).

.PP
\fB\-\-overwrite\fP=false
If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations.

.PP
\fB\-\-resource\-version\fP=""
If non\-empty, the annotation update will only succeed if this is the current resource\-version for the object. Only valid when specifying a single resource.

.PP
\fB\-t\fP, \fB\-\-template\fP=""
Template string or path to template file to use when \-o=template or \-o=templatefile. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]]


.SH OPTIONS INHERITED FROM PARENT COMMANDS
.PP
\fB\-\-alsologtostderr\fP=false
log to standard error as well as files

.PP
\fB\-\-api\-version\fP=""
The API version to use when talking to the server

.PP
\fB\-\-certificate\-authority\fP=""
Path to a cert. file for the certificate authority.

.PP
\fB\-\-client\-certificate\fP=""
Path to a client key file for TLS.

.PP
\fB\-\-client\-key\fP=""
Path to a client key file for TLS.

.PP
\fB\-\-cluster\fP=""
The name of the kubeconfig cluster to use

.PP
\fB\-\-context\fP=""
The name of the kubeconfig context to use

.PP
\fB\-\-insecure\-skip\-tls\-verify\fP=false
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.

.PP
\fB\-\-kubeconfig\fP=""
Path to the kubeconfig file to use for CLI requests.

.PP
\fB\-\-log\-backtrace\-at\fP=:0
when logging hits line file:N, emit a stack trace

.PP
\fB\-\-log\-dir\fP=""
If non\-empty, write log files in this directory

.PP
\fB\-\-log\-flush\-frequency\fP=5s
Maximum number of seconds between log flushes

.PP
\fB\-\-logtostderr\fP=true
log to standard error instead of files

.PP
\fB\-\-match\-server\-version\fP=false
Require server version to match client version

.PP
\fB\-\-namespace\fP=""
If present, the namespace scope for this CLI request.

.PP
\fB\-\-password\fP=""
Password for basic authentication to the API server.

.PP
\fB\-s\fP, \fB\-\-server\fP=""
The address and port of the Kubernetes API server

.PP
\fB\-\-stderrthreshold\fP=2
logs at or above this threshold go to stderr

.PP
\fB\-\-token\fP=""
Bearer token for authentication to the API server.

.PP
\fB\-\-user\fP=""
The name of the kubeconfig user to use

.PP
\fB\-\-username\fP=""
Username for basic authentication to the API server.

.PP
\fB\-\-v\fP=0
log level for V logs

.PP
\fB\-\-validate\fP=false
If true, use a schema to validate the input before sending it

.PP
\fB\-\-vmodule\fP=
comma\-separated list of pattern=N settings for file\-filtered logging


.SH EXAMPLE
.PP
.RS

.nf
# Update pod 'foo' with the annotation 'description' and the value 'my frontend'.
# If the same annotation is set multiple times, only the last value will be applied
$ kubectl annotate pods foo description='my frontend'

# Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value.
$ kubectl annotate \-\-overwrite pods foo description='my frontend running nginx'

# Update all pods in the namespace
$ kubectl annotate pods \-\-all description='my frontend running nginx'

# Update pod 'foo' only if the resource is unchanged from version 1.
$ kubectl annotate pods foo description='my frontend running nginx' \-\-resource\-version=1

# Update pod 'foo' by removing an annotation named 'description' if it exists.
# Does not require the \-\-overwrite flag.
$ kubectl annotate pods foo description\-

.fi
.RE


.SH SEE ALSO
.PP
\fBkubectl(1)\fP,


.SH HISTORY
.PP
January 2015, Originally compiled by Eric Paris (eparis at redhat dot com) based on the kubernetes source material, but hopefully they have been automatically generated since!
2 changes: 1 addition & 1 deletion docs/man/man1/kubectl.1
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Find more information at

.SH SEE ALSO
.PP
\fBkubectl\-get(1)\fP, \fBkubectl\-describe(1)\fP, \fBkubectl\-create(1)\fP, \fBkubectl\-replace(1)\fP, \fBkubectl\-patch(1)\fP, \fBkubectl\-delete(1)\fP, \fBkubectl\-namespace(1)\fP, \fBkubectl\-logs(1)\fP, \fBkubectl\-rolling\-update(1)\fP, \fBkubectl\-scale(1)\fP, \fBkubectl\-attach(1)\fP, \fBkubectl\-exec(1)\fP, \fBkubectl\-port\-forward(1)\fP, \fBkubectl\-proxy(1)\fP, \fBkubectl\-run(1)\fP, \fBkubectl\-stop(1)\fP, \fBkubectl\-expose(1)\fP, \fBkubectl\-label(1)\fP, \fBkubectl\-config(1)\fP, \fBkubectl\-cluster\-info(1)\fP, \fBkubectl\-api\-versions(1)\fP, \fBkubectl\-version(1)\fP,
\fBkubectl\-get(1)\fP, \fBkubectl\-describe(1)\fP, \fBkubectl\-create(1)\fP, \fBkubectl\-replace(1)\fP, \fBkubectl\-patch(1)\fP, \fBkubectl\-delete(1)\fP, \fBkubectl\-namespace(1)\fP, \fBkubectl\-logs(1)\fP, \fBkubectl\-rolling\-update(1)\fP, \fBkubectl\-scale(1)\fP, \fBkubectl\-attach(1)\fP, \fBkubectl\-exec(1)\fP, \fBkubectl\-port\-forward(1)\fP, \fBkubectl\-proxy(1)\fP, \fBkubectl\-run(1)\fP, \fBkubectl\-stop(1)\fP, \fBkubectl\-expose(1)\fP, \fBkubectl\-label(1)\fP, \fBkubectl\-annotate(1)\fP, \fBkubectl\-config(1)\fP, \fBkubectl\-cluster\-info(1)\fP, \fBkubectl\-api\-versions(1)\fP, \fBkubectl\-version(1)\fP,


.SH HISTORY
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/kubectl/.files_generated
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
kubectl.md
kubectl_annotate.md
kubectl_api-versions.md
kubectl_attach.md
kubectl_cluster-info.md
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/kubectl/kubectl.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ kubectl

### SEE ALSO

* [kubectl annotate](kubectl_annotate.md) - Update the annotations on a resource
* [kubectl api-versions](kubectl_api-versions.md) - Print available API versions.
* [kubectl attach](kubectl_attach.md) - Attach to a running container.
* [kubectl cluster-info](kubectl_cluster-info.md) - Display cluster info
Expand Down
128 changes: 128 additions & 0 deletions docs/user-guide/kubectl/kubectl_annotate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->

<!-- BEGIN STRIP_FOR_RELEASE -->

<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">

<h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>

If you are using a released version of Kubernetes, you should
refer to the docs that go with that version.

<strong>
The latest 1.0.x release of this document can be found
[here](http://releases.k8s.io/release-1.0/docs/user-guide/kubectl/kubectl_annotate.md).

Documentation for other releases can be found at
[releases.k8s.io](http://releases.k8s.io).
</strong>
--

<!-- END STRIP_FOR_RELEASE -->

<!-- END MUNGE: UNVERSIONED_WARNING -->

## kubectl annotate

Update the annotations on a resource

### Synopsis


Update the annotations on one or more resources.

An annotation is a key/value pair that can hold larger (compared to a label), and possibly not human-readable, data.
It is intended to store non-identifying auxiliary data, especially data manipulated by tools and system extensions.
If --overwrite is true, then existing annotations can be overwritten, otherwise attempting to overwrite an annotation 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.

Possible resources include (case insensitive): pods (po), services (svc),
replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs),
limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc),
resourcequotas (quota) or secrets.

```
kubectl annotate [--overwrite] RESOURCE NAME KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]
```

### Examples

```
# Update pod 'foo' with the annotation 'description' and the value 'my frontend'.
# If the same annotation is set multiple times, only the last value will be applied
$ kubectl annotate pods foo description='my frontend'

# Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value.
$ kubectl annotate --overwrite pods foo description='my frontend running nginx'

# Update all pods in the namespace
$ kubectl annotate pods --all description='my frontend running nginx'

# Update pod 'foo' only if the resource is unchanged from version 1.
$ kubectl annotate pods foo description='my frontend running nginx' --resource-version=1

# Update pod 'foo' by removing an annotation named 'description' if it exists.
# Does not require the --overwrite flag.
$ kubectl annotate pods foo description-
```

### Options

```
--all=false: select all resources in the namespace of the specified resource types
-h, --help=false: help for annotate
--no-headers=false: When using the default output, don't print headers.
-o, --output="": Output format. One of: json|yaml|template|templatefile|wide.
--output-version="": Output the formatted object with the given version (default api-version).
--overwrite=false: If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations.
--resource-version="": If non-empty, the annotation update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource.
-t, --template="": Template string or path to template file to use when -o=template or -o=templatefile. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]
```

### Options inherited from parent commands

```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--kubeconfig="": Path to the kubeconfig file to use for CLI requests.
--log-backtrace-at=:0: when logging hits line file:N, emit a stack trace
--log-dir=: If non-empty, write log files in this directory
--log-flush-frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```

### SEE ALSO

* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager

###### Auto generated by spf13/cobra at 2015-08-03 21:33:00.41118358 +0000 UTC

<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_annotate.md?pixel)]()
<!-- END MUNGE: GENERATED_ANALYTICS -->
Loading