mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #5237 from jszczepkowski/stop-labels
Added support for labels to "kubectl stop".
This commit is contained in:
		@@ -17,7 +17,7 @@ submits an update to a resource right when you submit a delete, their update
 | 
				
			|||||||
will be lost along with the rest of the resource.
 | 
					will be lost along with the rest of the resource.
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kubectl delete ([-f filename] | (<resource> [(<id> | -l <label> | --all)]
 | 
					kubectl delete (-f filename | <resource> (<id> | -l <label> | --all))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Examples
 | 
					### Examples
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ Attempts to shut down and delete a resource that supports graceful termination.
 | 
				
			|||||||
If the resource is resizable it will be resized to 0 before deletion.
 | 
					If the resource is resizable it will be resized to 0 before deletion.
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kubectl stop (<resource> <id>|-f filename)
 | 
					kubectl stop (-f filename | <resource> (<id> | -l <label> | --all))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Examples
 | 
					### Examples
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -19,6 +19,9 @@ kubectl stop (<resource> <id>|-f filename)
 | 
				
			|||||||
// Shut down foo.
 | 
					// Shut down foo.
 | 
				
			||||||
$ kubectl stop replicationcontroller foo
 | 
					$ kubectl stop replicationcontroller foo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Stop pods and services with label name=myLabel.
 | 
				
			||||||
 | 
					$ kubectl stop pods,services -l name=myLabel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Shut down the service defined in service.json
 | 
					// Shut down the service defined in service.json
 | 
				
			||||||
$ kubectl stop -f service.json
 | 
					$ kubectl stop -f service.json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -29,7 +32,9 @@ $ kubectl stop -f path/to/resources
 | 
				
			|||||||
### Options
 | 
					### Options
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					      --all=false: [-all] to select all the specified resources
 | 
				
			||||||
  -f, --filename=[]: Filename, directory, or URL to file of resource(s) to be stopped
 | 
					  -f, --filename=[]: Filename, directory, or URL to file of resource(s) to be stopped
 | 
				
			||||||
 | 
					  -l, --selector="": Selector (label query) to filter on
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Options inherrited from parent commands
 | 
					### Options inherrited from parent commands
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,10 +21,18 @@ If the resource is resizable it will be resized to 0 before deletion.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.SH OPTIONS
 | 
					.SH OPTIONS
 | 
				
			||||||
 | 
					.PP
 | 
				
			||||||
 | 
					\fB\-\-all\fP=false
 | 
				
			||||||
 | 
					    [\-all] to select all the specified resources
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PP
 | 
					.PP
 | 
				
			||||||
\fB\-f\fP, \fB\-\-filename\fP=[]
 | 
					\fB\-f\fP, \fB\-\-filename\fP=[]
 | 
				
			||||||
    Filename, directory, or URL to file of resource(s) to be stopped
 | 
					    Filename, directory, or URL to file of resource(s) to be stopped
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PP
 | 
				
			||||||
 | 
					\fB\-l\fP, \fB\-\-selector\fP=""
 | 
				
			||||||
 | 
					    Selector (label query) to filter on
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.SH OPTIONS INHERITED FROM PARENT COMMANDS
 | 
					.SH OPTIONS INHERITED FROM PARENT COMMANDS
 | 
				
			||||||
.PP
 | 
					.PP
 | 
				
			||||||
@@ -140,6 +148,9 @@ If the resource is resizable it will be resized to 0 before deletion.
 | 
				
			|||||||
// Shut down foo.
 | 
					// Shut down foo.
 | 
				
			||||||
$ kubectl stop replicationcontroller foo
 | 
					$ kubectl stop replicationcontroller foo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Stop pods and services with label name=myLabel.
 | 
				
			||||||
 | 
					$ kubectl stop pods,services \-l name=myLabel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Shut down the service defined in service.json
 | 
					// Shut down the service defined in service.json
 | 
				
			||||||
$ kubectl stop \-f service.json
 | 
					$ kubectl stop \-f service.json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,7 +60,7 @@ func (f *Factory) NewCmdDelete(out io.Writer) *cobra.Command {
 | 
				
			|||||||
		Filenames util.StringList
 | 
							Filenames util.StringList
 | 
				
			||||||
	}{}
 | 
						}{}
 | 
				
			||||||
	cmd := &cobra.Command{
 | 
						cmd := &cobra.Command{
 | 
				
			||||||
		Use:     "delete ([-f filename] | (<resource> [(<id> | -l <label> | --all)]",
 | 
							Use:     "delete (-f filename | <resource> (<id> | -l <label> | --all))",
 | 
				
			||||||
		Short:   "Delete a resource by filename, stdin, or resource and ID.",
 | 
							Short:   "Delete a resource by filename, stdin, or resource and ID.",
 | 
				
			||||||
		Long:    delete_long,
 | 
							Long:    delete_long,
 | 
				
			||||||
		Example: delete_example,
 | 
							Example: delete_example,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,6 +34,9 @@ If the resource is resizable it will be resized to 0 before deletion.`
 | 
				
			|||||||
	stop_example = `// Shut down foo.
 | 
						stop_example = `// Shut down foo.
 | 
				
			||||||
$ kubectl stop replicationcontroller foo
 | 
					$ kubectl stop replicationcontroller foo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Stop pods and services with label name=myLabel.
 | 
				
			||||||
 | 
					$ kubectl stop pods,services -l name=myLabel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Shut down the service defined in service.json
 | 
					// Shut down the service defined in service.json
 | 
				
			||||||
$ kubectl stop -f service.json
 | 
					$ kubectl stop -f service.json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -46,7 +49,7 @@ func (f *Factory) NewCmdStop(out io.Writer) *cobra.Command {
 | 
				
			|||||||
		Filenames util.StringList
 | 
							Filenames util.StringList
 | 
				
			||||||
	}{}
 | 
						}{}
 | 
				
			||||||
	cmd := &cobra.Command{
 | 
						cmd := &cobra.Command{
 | 
				
			||||||
		Use:     "stop (<resource> <id>|-f filename)",
 | 
							Use:     "stop (-f filename | <resource> (<id> | -l <label> | --all))",
 | 
				
			||||||
		Short:   "Gracefully shut down a resource by id or filename.",
 | 
							Short:   "Gracefully shut down a resource by id or filename.",
 | 
				
			||||||
		Long:    stop_long,
 | 
							Long:    stop_long,
 | 
				
			||||||
		Example: stop_example,
 | 
							Example: stop_example,
 | 
				
			||||||
@@ -59,6 +62,8 @@ func (f *Factory) NewCmdStop(out io.Writer) *cobra.Command {
 | 
				
			|||||||
				NamespaceParam(cmdNamespace).RequireNamespace().
 | 
									NamespaceParam(cmdNamespace).RequireNamespace().
 | 
				
			||||||
				ResourceTypeOrNameArgs(false, args...).
 | 
									ResourceTypeOrNameArgs(false, args...).
 | 
				
			||||||
				FilenameParam(flags.Filenames...).
 | 
									FilenameParam(flags.Filenames...).
 | 
				
			||||||
 | 
									SelectorParam(cmdutil.GetFlagString(cmd, "selector")).
 | 
				
			||||||
 | 
									SelectAllParam(cmdutil.GetFlagBool(cmd, "all")).
 | 
				
			||||||
				Flatten().
 | 
									Flatten().
 | 
				
			||||||
				Do()
 | 
									Do()
 | 
				
			||||||
			cmdutil.CheckErr(r.Err())
 | 
								cmdutil.CheckErr(r.Err())
 | 
				
			||||||
@@ -76,5 +81,7 @@ func (f *Factory) NewCmdStop(out io.Writer) *cobra.Command {
 | 
				
			|||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	cmd.Flags().VarP(&flags.Filenames, "filename", "f", "Filename, directory, or URL to file of resource(s) to be stopped")
 | 
						cmd.Flags().VarP(&flags.Filenames, "filename", "f", "Filename, directory, or URL to file of resource(s) to be stopped")
 | 
				
			||||||
 | 
						cmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on")
 | 
				
			||||||
 | 
						cmd.Flags().Bool("all", false, "[-all] to select all the specified resources")
 | 
				
			||||||
	return cmd
 | 
						return cmd
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user