From b83ef70ff401f167f60a79db5e756c8c010cf595 Mon Sep 17 00:00:00 2001 From: yyzxw <34639446+yyzxw@users.noreply.github.com> Date: Mon, 17 Jun 2024 22:25:37 +0800 Subject: [PATCH] chore: fix and add more cli usage case (#3592) Signed-off-by: xiaowu.zhu --- .../kubectl-argo-rollouts_dashboard.md | 10 ++++++++++ .../kubectl-argo-rollouts_get_rollout.md | 3 +++ .../kubectl-argo-rollouts_list_experiments.md | 2 +- .../kubectl-argo-rollouts_list_rollouts.md | 3 +++ .../kubectl-argo-rollouts_set_image.md | 4 ++-- .../kubectl-argo-rollouts_status.md | 3 +++ .../kubectl-argo-rollouts_terminate.md | 2 +- .../kubectl-argo-rollouts_terminate_analysisrun.md | 2 +- .../kubectl-argo-rollouts_undo.md | 2 +- .../cmd/dashboard/dashboard.go | 14 ++++++++++++-- pkg/kubectl-argo-rollouts/cmd/get/get_rollout.go | 5 ++++- pkg/kubectl-argo-rollouts/cmd/lint/lint.go | 7 +------ .../cmd/list/list_experiments.go | 2 +- .../cmd/list/list_rollouts.go | 3 +++ pkg/kubectl-argo-rollouts/cmd/set/set_image.go | 4 ++-- pkg/kubectl-argo-rollouts/cmd/status/status.go | 3 +++ .../cmd/terminate/terminate.go | 4 ++-- pkg/kubectl-argo-rollouts/cmd/undo/undo.go | 2 +- 18 files changed, 54 insertions(+), 21 deletions(-) diff --git a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_dashboard.md b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_dashboard.md index eb6ee9e6fc..ad99bfb5ca 100644 --- a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_dashboard.md +++ b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_dashboard.md @@ -10,6 +10,16 @@ Start UI dashboard kubectl argo rollouts dashboard [flags] ``` +## Examples + +```shell +# Start UI dashboard +kubectl argo rollouts dashboard + +# Start UI dashboard on a specific port +kubectl argo rollouts dashboard --port 8080 +``` + ## Options ``` diff --git a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_get_rollout.md b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_get_rollout.md index 77b04d2217..4654f2f9c5 100644 --- a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_get_rollout.md +++ b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_get_rollout.md @@ -30,6 +30,9 @@ kubectl argo rollouts get rollout guestbook # Watch progress of a rollout kubectl argo rollouts get rollout guestbook -w + +# Watch the rollout, fail if it takes more than 60 seconds +kubectl argo rollouts get rollout guestbook -w --timeout-seconds 60 ``` ## Options diff --git a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_list_experiments.md b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_list_experiments.md index 4add56c247..39d9f902bb 100644 --- a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_list_experiments.md +++ b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_list_experiments.md @@ -26,7 +26,7 @@ kubectl argo rollouts list experiments --watch ## Options ``` - --all-namespaces Include all namespaces + -A, --all-namespaces Include all namespaces -h, --help help for experiments ``` diff --git a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_list_rollouts.md b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_list_rollouts.md index e861ca20c8..7382d88185 100644 --- a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_list_rollouts.md +++ b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_list_rollouts.md @@ -16,6 +16,9 @@ kubectl argo rollouts list rollouts [flags] # List rollouts kubectl argo rollouts list rollouts +# List rollouts with a specific name +kubectl argo rollouts list rollouts --name my-rollout + # List rollouts from all namespaces kubectl argo rollouts list rollouts --all-namespaces diff --git a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_set_image.md b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_set_image.md index 5f89a6a506..1ad60ac547 100644 --- a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_set_image.md +++ b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_set_image.md @@ -13,8 +13,8 @@ kubectl argo rollouts set image ROLLOUT_NAME CONTAINER=IMAGE [flags] ## Examples ```shell -# Set rollout image -kubectl argo rollouts set image my-rollout www=image:v2 +# Set rollout image (containers contains 'initContainer', 'container', 'ephemeralContainer') +kubectl argo rollouts set image my-rollout containerName=imageName ``` ## Options diff --git a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_status.md b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_status.md index e1221d4056..4bfff8b586 100644 --- a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_status.md +++ b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_status.md @@ -17,6 +17,9 @@ kubectl argo rollouts status ROLLOUT_NAME [flags] # Watch the rollout until it succeeds kubectl argo rollouts status guestbook +# Show the rollout status +kubectl argo rollouts status guestbook --watch false + # Watch the rollout until it succeeds, fail if it takes more than 60 seconds kubectl argo rollouts status --timeout 60s guestbook diff --git a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_terminate.md b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_terminate.md index 4491cca5fe..21881976dc 100644 --- a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_terminate.md +++ b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_terminate.md @@ -13,7 +13,7 @@ kubectl argo rollouts terminate RESOURCE_NAME [flags] ## Examples ```shell -# Terminate an analysisRun +# Terminate an AnalysisRun kubectl argo rollouts terminate analysisrun guestbook-877894d5b-4-success-rate.1 # Terminate a failed experiment diff --git a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_terminate_analysisrun.md b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_terminate_analysisrun.md index 268b7a0150..3ff552e97a 100644 --- a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_terminate_analysisrun.md +++ b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_terminate_analysisrun.md @@ -14,7 +14,7 @@ kubectl argo rollouts terminate analysisrun ANALYSISRUN_NAME [flags] ```shell # Terminate an AnalysisRun -kubectl argo rollouts terminate analysis guestbook-877894d5b-4-success-rate.1 +kubectl argo rollouts terminate analysisrun guestbook-877894d5b-4-success-rate.1 ``` ## Options diff --git a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_undo.md b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_undo.md index 0ddf539dc9..e6d95a203b 100644 --- a/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_undo.md +++ b/docs/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_undo.md @@ -16,7 +16,7 @@ kubectl argo rollouts undo ROLLOUT_NAME [flags] # Undo a rollout kubectl argo rollouts undo guestbook -# Undo a rollout revision 3 +# Undo a rollout to revision 3 kubectl argo rollouts undo guestbook --to-revision=3 ``` diff --git a/pkg/kubectl-argo-rollouts/cmd/dashboard/dashboard.go b/pkg/kubectl-argo-rollouts/cmd/dashboard/dashboard.go index f0c720df72..468d0437c6 100644 --- a/pkg/kubectl-argo-rollouts/cmd/dashboard/dashboard.go +++ b/pkg/kubectl-argo-rollouts/cmd/dashboard/dashboard.go @@ -8,12 +8,22 @@ import ( "github.com/spf13/cobra" ) +var ( + dashBoardExample = ` + # Start UI dashboard + %[1]s dashboard + + # Start UI dashboard on a specific port + %[1]s dashboard --port 8080` +) + func NewCmdDashboard(o *options.ArgoRolloutsOptions) *cobra.Command { var rootPath string var port int var cmd = &cobra.Command{ - Use: "dashboard", - Short: "Start UI dashboard", + Use: "dashboard", + Short: "Start UI dashboard", + Example: o.Example(dashBoardExample), RunE: func(c *cobra.Command, args []string) error { namespace := o.Namespace() kubeclientset := o.KubeClientset() diff --git a/pkg/kubectl-argo-rollouts/cmd/get/get_rollout.go b/pkg/kubectl-argo-rollouts/cmd/get/get_rollout.go index f5b0719509..dd56693a45 100644 --- a/pkg/kubectl-argo-rollouts/cmd/get/get_rollout.go +++ b/pkg/kubectl-argo-rollouts/cmd/get/get_rollout.go @@ -25,7 +25,10 @@ const ( %[1]s get rollout guestbook # Watch progress of a rollout - %[1]s get rollout guestbook -w` + %[1]s get rollout guestbook -w + + # Watch the rollout, fail if it takes more than 60 seconds + %[1]s get rollout guestbook -w --timeout-seconds 60` ) // NewCmdGetRollout returns a new instance of an `rollouts get rollout` command diff --git a/pkg/kubectl-argo-rollouts/cmd/lint/lint.go b/pkg/kubectl-argo-rollouts/cmd/lint/lint.go index 810abf2c8e..4d8a268994 100644 --- a/pkg/kubectl-argo-rollouts/cmd/lint/lint.go +++ b/pkg/kubectl-argo-rollouts/cmd/lint/lint.go @@ -53,12 +53,7 @@ func NewCmdLint(o *options.ArgoRolloutsOptions) *cobra.Command { return o.UsageErr(c) } - err := lintOptions.lintResource(lintOptions.File) - if err != nil { - return err - } - - return nil + return lintOptions.lintResource(lintOptions.File) }, } cmd.Flags().StringVarP(&lintOptions.File, "filename", "f", "", "File to lint") diff --git a/pkg/kubectl-argo-rollouts/cmd/list/list_experiments.go b/pkg/kubectl-argo-rollouts/cmd/list/list_experiments.go index cb83a157fa..962b4d6ce4 100644 --- a/pkg/kubectl-argo-rollouts/cmd/list/list_experiments.go +++ b/pkg/kubectl-argo-rollouts/cmd/list/list_experiments.go @@ -62,7 +62,7 @@ func NewCmdListExperiments(o *options.ArgoRolloutsOptions) *cobra.Command { return nil }, } - cmd.Flags().BoolVar(&listOptions.allNamespaces, "all-namespaces", false, "Include all namespaces") + cmd.Flags().BoolVarP(&listOptions.allNamespaces, "all-namespaces", "A", false, "Include all namespaces") return cmd } diff --git a/pkg/kubectl-argo-rollouts/cmd/list/list_rollouts.go b/pkg/kubectl-argo-rollouts/cmd/list/list_rollouts.go index 6746876767..c233776c6d 100644 --- a/pkg/kubectl-argo-rollouts/cmd/list/list_rollouts.go +++ b/pkg/kubectl-argo-rollouts/cmd/list/list_rollouts.go @@ -18,6 +18,9 @@ const ( listRolloutsExample = ` # List rollouts %[1]s list rollouts + + # List rollouts with a specific name + %[1]s list rollouts --name my-rollout # List rollouts from all namespaces %[1]s list rollouts --all-namespaces diff --git a/pkg/kubectl-argo-rollouts/cmd/set/set_image.go b/pkg/kubectl-argo-rollouts/cmd/set/set_image.go index 1a5b5dce24..d2f199a4a4 100644 --- a/pkg/kubectl-argo-rollouts/cmd/set/set_image.go +++ b/pkg/kubectl-argo-rollouts/cmd/set/set_image.go @@ -19,8 +19,8 @@ import ( const ( setImageExample = ` - # Set rollout image - %[1]s set image my-rollout www=image:v2` + # Set rollout image (containers contains 'initContainer', 'container', 'ephemeralContainer') + %[1]s set image my-rollout containerName=imageName` ) const ( diff --git a/pkg/kubectl-argo-rollouts/cmd/status/status.go b/pkg/kubectl-argo-rollouts/cmd/status/status.go index 79d7272d88..33d6652900 100644 --- a/pkg/kubectl-argo-rollouts/cmd/status/status.go +++ b/pkg/kubectl-argo-rollouts/cmd/status/status.go @@ -20,6 +20,9 @@ the rollout is healthy upon completion and an error otherwise.` # Watch the rollout until it succeeds %[1]s status guestbook + # Show the rollout status + %[1]s status guestbook --watch false + # Watch the rollout until it succeeds, fail if it takes more than 60 seconds %[1]s status --timeout 60s guestbook ` diff --git a/pkg/kubectl-argo-rollouts/cmd/terminate/terminate.go b/pkg/kubectl-argo-rollouts/cmd/terminate/terminate.go index f0dd7e91b1..c4123f0e78 100644 --- a/pkg/kubectl-argo-rollouts/cmd/terminate/terminate.go +++ b/pkg/kubectl-argo-rollouts/cmd/terminate/terminate.go @@ -18,7 +18,7 @@ const ( const ( terminateExample = ` - # Terminate an analysisRun + # Terminate an AnalysisRun %[1]s terminate analysisrun guestbook-877894d5b-4-success-rate.1 # Terminate a failed experiment @@ -26,7 +26,7 @@ const ( terminateAnalysisRunExample = ` # Terminate an AnalysisRun - %[1]s terminate analysis guestbook-877894d5b-4-success-rate.1` + %[1]s terminate analysisrun guestbook-877894d5b-4-success-rate.1` terminateExperimentExample = ` # Terminate an experiment diff --git a/pkg/kubectl-argo-rollouts/cmd/undo/undo.go b/pkg/kubectl-argo-rollouts/cmd/undo/undo.go index d3a78d15f2..be9d0289d7 100644 --- a/pkg/kubectl-argo-rollouts/cmd/undo/undo.go +++ b/pkg/kubectl-argo-rollouts/cmd/undo/undo.go @@ -32,7 +32,7 @@ const ( # Undo a rollout %[1]s undo guestbook - # Undo a rollout revision 3 + # Undo a rollout to revision 3 %[1]s undo guestbook --to-revision=3` )