Skip to content

Commit

Permalink
Merge pull request kubernetes#17701 from hurf/anno_label
Browse files Browse the repository at this point in the history
Auto commit by PR queue bot
  • Loading branch information
k8s-merge-robot committed Nov 26, 2015
2 parents d800e02 + ad26db7 commit 70d2a02
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contrib/completions/bash/kubectl
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,8 @@ _kubectl_annotate()
flags+=("--output-version=")
flags+=("--overwrite")
flags+=("--resource-version=")
flags+=("--selector=")
two_word_flags+=("-l")
flags+=("--show-all")
flags+=("-a")
flags+=("--sort-by=")
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/kubectl-annotate.1
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ horizontalpodautoscalers (hpa), resourcequotas (quota) or secrets.
\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\-l\fP, \fB\-\-selector\fP=""
Selector (label query) to filter on

.PP
\fB\-a\fP, \fB\-\-show\-all\fP=false
When printing, show all resources (default hide terminated pods.)
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/kubectl/kubectl_annotate.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ $ kubectl annotate pods foo description-
--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.
-l, --selector="": Selector (label query) to filter on
-a, --show-all[=false]: When printing, show all resources (default hide terminated pods.)
--sort-by="": If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. 'ObjectMeta.Name'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
--template="": Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
Expand Down
3 changes: 3 additions & 0 deletions pkg/kubectl/cmd/annotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type AnnotateOptions struct {
removeAnnotations []string
builder *resource.Builder
filenames []string
selector string

overwrite bool
all bool
Expand Down Expand Up @@ -103,6 +104,7 @@ func NewCmdAnnotate(f *cmdutil.Factory, out io.Writer) *cobra.Command {
},
}
cmdutil.AddPrinterFlags(cmd)
cmd.Flags().StringVarP(&options.selector, "selector", "l", "", "Selector (label query) to filter on")
cmd.Flags().BoolVar(&options.overwrite, "overwrite", false, "If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations.")
cmd.Flags().BoolVar(&options.all, "all", false, "select all resources in the namespace of the specified resource types")
cmd.Flags().StringVar(&options.resourceVersion, "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.")
Expand Down Expand Up @@ -153,6 +155,7 @@ func (o *AnnotateOptions) Complete(f *cmdutil.Factory, out io.Writer, cmd *cobra
ContinueOnError().
NamespaceParam(namespace).DefaultNamespace().
FilenameParam(enforceNamespace, o.filenames...).
SelectorParam(o.selector).
ResourceTypeOrNameArgs(o.all, o.resources...).
Flatten().
Latest()
Expand Down

0 comments on commit 70d2a02

Please sign in to comment.