Skip to content

Commit

Permalink
chore: fix and add more cli usage case (#3592)
Browse files Browse the repository at this point in the history
Signed-off-by: xiaowu.zhu <[email protected]>
  • Loading branch information
yyzxw authored Jun 17, 2024
1 parent 112dd4f commit b83ef70
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ kubectl argo rollouts terminate <analysisrun|experiment> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
14 changes: 12 additions & 2 deletions pkg/kubectl-argo-rollouts/cmd/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 4 additions & 1 deletion pkg/kubectl-argo-rollouts/cmd/get/get_rollout.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions pkg/kubectl-argo-rollouts/cmd/lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubectl-argo-rollouts/cmd/list/list_experiments.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/kubectl-argo-rollouts/cmd/list/list_rollouts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/kubectl-argo-rollouts/cmd/set/set_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
3 changes: 3 additions & 0 deletions pkg/kubectl-argo-rollouts/cmd/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`
Expand Down
4 changes: 2 additions & 2 deletions pkg/kubectl-argo-rollouts/cmd/terminate/terminate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ const (

const (
terminateExample = `
# Terminate an analysisRun
# Terminate an AnalysisRun
%[1]s terminate analysisrun guestbook-877894d5b-4-success-rate.1
# Terminate a failed experiment
%[1]s terminate experiment my-experiment`

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
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubectl-argo-rollouts/cmd/undo/undo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`
)

Expand Down

0 comments on commit b83ef70

Please sign in to comment.