mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-16 15:20:17 +00:00
Merge pull request #34106 from kargakis/rollout-status-watch-flag
Automatic merge from submit-queue kubectl: add watch flag in rollout status Fixes https://github.com/kubernetes/kubernetes/issues/30627 @kubernetes/kubectl
This commit is contained in:
commit
87393e1da9
@ -32,7 +32,11 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
status_long = dedent.Dedent(`
|
status_long = dedent.Dedent(`
|
||||||
Watch the status of current rollout, until it's done.`)
|
Show the status of the newest rollout.
|
||||||
|
|
||||||
|
By default 'rollout status' will watch the status of the newest rollout
|
||||||
|
until it's done. If you don't want to wait for the rollout to finish then
|
||||||
|
you can use --watch=false.`)
|
||||||
status_example = dedent.Dedent(`
|
status_example = dedent.Dedent(`
|
||||||
# Watch the rollout status of a deployment
|
# Watch the rollout status of a deployment
|
||||||
kubectl rollout status deployment/nginx`)
|
kubectl rollout status deployment/nginx`)
|
||||||
@ -46,7 +50,7 @@ func NewCmdRolloutStatus(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
|||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "status (TYPE NAME | TYPE/NAME) [flags]",
|
Use: "status (TYPE NAME | TYPE/NAME) [flags]",
|
||||||
Short: "Watch rollout status until it's done",
|
Short: "Show the status of newest rollout",
|
||||||
Long: status_long,
|
Long: status_long,
|
||||||
Example: status_example,
|
Example: status_example,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
@ -58,6 +62,7 @@ func NewCmdRolloutStatus(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
|||||||
|
|
||||||
usage := "identifying the resource to get from a server."
|
usage := "identifying the resource to get from a server."
|
||||||
cmdutil.AddFilenameOptionFlags(cmd, options, usage)
|
cmdutil.AddFilenameOptionFlags(cmd, options, usage)
|
||||||
|
cmd.Flags().BoolP("watch", "w", true, "Watch the status of the newest rollout until it's done.")
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,6 +124,11 @@ func RunStatus(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, args []str
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shouldWatch := cmdutil.GetFlagBool(cmd, "watch")
|
||||||
|
if !shouldWatch {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// watch for changes to the deployment
|
// watch for changes to the deployment
|
||||||
w, err := r.Watch(rv)
|
w, err := r.Watch(rv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user