Merge pull request #13131 from hurf/anno_unused

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2015-09-01 04:32:13 -07:00
commit a4d953f4b3
5 changed files with 7 additions and 53 deletions

View File

@ -854,17 +854,8 @@ _kubectl_annotate()
flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
flags+=("--help")
flags+=("-h")
flags+=("--no-headers")
flags+=("--output=")
two_word_flags+=("-o")
flags+=("--output-version=")
flags+=("--overwrite")
flags+=("--resource-version=")
flags+=("--show-all")
flags+=("-a")
flags+=("--sort-by=")
flags+=("--template=")
two_word_flags+=("-t")
must_have_one_flag=()
must_have_one_noun=()

View File

@ -41,18 +41,6 @@ resourcequotas (quota) or secrets.
\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|jsonpath|name.
.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.
@ -61,20 +49,6 @@ 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\-a\fP, \fB\-\-show\-all\fP=false
When printing, show all resources (default hide terminated pods.)
.PP
\fB\-\-sort\-by\fP=""
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.
.PP
\fB\-t\fP, \fB\-\-template\fP=""
Template string or path to template file to use when \-o=template, \-o=templatefile or \-o=jsonpath. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]]. The jsonpath template is composed of jsonpath expressions enclosed by {} [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]]
.SH OPTIONS INHERITED FROM PARENT COMMANDS
.PP

View File

@ -84,14 +84,8 @@ $ kubectl annotate pods foo description-
--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 annotation
-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|jsonpath|name.
--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.
-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=template, -o=templatefile or -o=jsonpath. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. The jsonpath template is composed of jsonpath expressions enclosed by {} [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md]
```
### Options inherited from parent commands
@ -126,7 +120,7 @@ $ kubectl annotate pods foo description-
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra at 2015-08-25 11:50:09.184436452 +0000 UTC
###### Auto generated by spf13/cobra at 2015-08-27 02:40:25.687121316 +0000 UTC
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_annotate.md?pixel)]()

View File

@ -32,7 +32,6 @@ import (
// AnnotateOptions have the data required to perform the annotate operation
type AnnotateOptions struct {
out io.Writer
resources []string
newAnnotations map[string]string
removeAnnotations []string
@ -87,7 +86,7 @@ func NewCmdAnnotate(f *cmdutil.Factory, out io.Writer) *cobra.Command {
Example: annotate_example,
Run: func(cmd *cobra.Command, args []string) {
options.filenames = cmdutil.GetFlagStringSlice(cmd, "filename")
if err := options.Complete(f, args, out); err != nil {
if err := options.Complete(f, args); err != nil {
cmdutil.CheckErr(err)
}
if err := options.Validate(args); err != nil {
@ -98,7 +97,6 @@ func NewCmdAnnotate(f *cmdutil.Factory, out io.Writer) *cobra.Command {
}
},
}
cmdutil.AddPrinterFlags(cmd)
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.")
@ -108,7 +106,7 @@ func NewCmdAnnotate(f *cmdutil.Factory, out io.Writer) *cobra.Command {
}
// Complete adapts from the command line args and factory to the data required.
func (o *AnnotateOptions) Complete(f *cmdutil.Factory, args []string, out io.Writer) (err error) {
func (o *AnnotateOptions) Complete(f *cmdutil.Factory, args []string) (err error) {
namespace, enforceNamespace, err := f.DefaultNamespace()
if err != nil {
return err

View File

@ -401,7 +401,7 @@ func TestAnnotateErrors(t *testing.T) {
cmd.Flags().Set(k, v)
}
options := &AnnotateOptions{}
err := options.Complete(f, testCase.args, buf)
err := options.Complete(f, testCase.args)
if !testCase.errFn(err) {
t.Errorf("%s: unexpected error: %v", k, err)
continue
@ -448,11 +448,10 @@ func TestAnnotateObject(t *testing.T) {
}
tf.Namespace = "test"
tf.ClientConfig = &client.Config{Version: testapi.Version()}
buf := bytes.NewBuffer([]byte{})
options := &AnnotateOptions{}
args := []string{"pods/foo", "a=b", "c-"}
if err := options.Complete(f, args, buf); err != nil {
if err := options.Complete(f, args); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if err := options.Validate(args); err != nil {
@ -496,12 +495,11 @@ func TestAnnotateObjectFromFile(t *testing.T) {
}
tf.Namespace = "test"
tf.ClientConfig = &client.Config{Version: testapi.Version()}
buf := bytes.NewBuffer([]byte{})
options := &AnnotateOptions{}
options.filenames = []string{"../../../examples/cassandra/cassandra.yaml"}
args := []string{"a=b", "c-"}
if err := options.Complete(f, args, buf); err != nil {
if err := options.Complete(f, args); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if err := options.Validate(args); err != nil {
@ -547,12 +545,11 @@ func TestAnnotateMultipleObjects(t *testing.T) {
}
tf.Namespace = "test"
tf.ClientConfig = &client.Config{Version: testapi.Version()}
buf := bytes.NewBuffer([]byte{})
options := &AnnotateOptions{}
options.all = true
args := []string{"pods", "a=b", "c-"}
if err := options.Complete(f, args, buf); err != nil {
if err := options.Complete(f, args); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if err := options.Validate(args); err != nil {