From bc3169a1b51eefcf8fa3ab938d4a8bc33432c02a Mon Sep 17 00:00:00 2001 From: zzxwill Date: Fri, 11 Sep 2020 19:33:13 +0800 Subject: [PATCH] Rename `vela env switch` to `vela env set` Renaming and update cli documentation Fix #235 --- CONTRIBUTING.md | 6 +-- README.md | 4 +- cmd/vela/main.go | 1 + .../api/vela-restful-api-reference.md | 4 +- documentation/cli/vela.md | 30 +++++--------- documentation/cli/vela_app.md | 36 +++++++++++++++++ documentation/cli/vela_app_delete.md | 12 +++--- documentation/cli/vela_app_ls.md | 6 +-- documentation/cli/vela_app_run.md | 8 ++-- documentation/cli/vela_app_show.md | 10 ++--- documentation/cli/vela_app_status.md | 10 ++--- documentation/cli/vela_cap.md | 29 ++++++++++++++ documentation/cli/vela_cap_add.md | 6 +-- documentation/cli/vela_cap_center.md | 29 ++++++++++++++ documentation/cli/vela_cap_center_config.md | 8 ++-- documentation/cli/vela_cap_center_ls.md | 35 ++++++++++++++++ documentation/cli/vela_cap_center_remove.md | 35 ++++++++++++++++ documentation/cli/vela_cap_center_sync.md | 6 +-- documentation/cli/vela_cap_ls.md | 6 +-- documentation/cli/vela_cap_remove.md | 6 +-- documentation/cli/vela_comp.md | 31 ++++++++++++++ documentation/cli/vela_comp_delete.md | 36 +++++++++++++++++ documentation/cli/vela_comp_ls.md | 36 +++++++++++++++++ documentation/cli/vela_comp_run.md | 22 +++++----- documentation/cli/vela_comp_show.md | 36 +++++++++++++++++ documentation/cli/vela_comp_status.md | 36 +++++++++++++++++ documentation/cli/vela_completion.md | 4 +- documentation/cli/vela_completion_bash.md | 2 +- documentation/cli/vela_completion_zsh.md | 2 +- documentation/cli/vela_dashboard.md | 12 ++++-- documentation/cli/vela_deployment_run.md | 40 ------------------- documentation/cli/vela_env.md | 22 ++++------ documentation/cli/vela_env_delete.md | 6 +-- documentation/cli/vela_env_init.md | 8 ++-- documentation/cli/vela_env_ls.md | 35 ++++++++++++++++ documentation/cli/vela_env_set.md | 35 ++++++++++++++++ documentation/cli/vela_env_sw.md | 35 ---------------- documentation/cli/vela_install.md | 8 ++-- documentation/cli/vela_logs.md | 29 ++++++++++++++ documentation/cli/vela_manualscaler.md | 39 ++++++++++++++++++ documentation/cli/vela_rollout.md | 5 ++- documentation/cli/vela_rollout_detach.md | 37 ----------------- documentation/cli/vela_scale.md | 5 ++- documentation/cli/vela_scale_detach.md | 37 ----------------- documentation/cli/vela_system.md | 27 +++++++++++++ documentation/cli/vela_system_info.md | 14 +++---- documentation/cli/vela_system_update.md | 6 +-- documentation/cli/vela_traits.md | 4 +- documentation/cli/vela_version.md | 4 +- documentation/cli/vela_workloads.md | 4 +- e2e/apiserver/apiserver_test.go | 6 +-- e2e/application/application_test.go | 2 +- e2e/commonContext.go | 6 +-- e2e/env/env_test.go | 2 +- e2e/trait/trait_test.go | 2 +- e2e/workload/workload_test.go | 2 +- pkg/commands/env.go | 20 +++++----- pkg/commands/env_test.go | 14 +++---- pkg/oam/env.go | 8 ++-- pkg/server/handler/envHandlers.go | 6 +-- pkg/server/route.go | 2 +- 61 files changed, 659 insertions(+), 315 deletions(-) create mode 100644 documentation/cli/vela_app.md create mode 100644 documentation/cli/vela_cap.md create mode 100644 documentation/cli/vela_cap_center.md create mode 100644 documentation/cli/vela_cap_center_ls.md create mode 100644 documentation/cli/vela_cap_center_remove.md create mode 100644 documentation/cli/vela_comp.md create mode 100644 documentation/cli/vela_comp_delete.md create mode 100644 documentation/cli/vela_comp_ls.md create mode 100644 documentation/cli/vela_comp_show.md create mode 100644 documentation/cli/vela_comp_status.md delete mode 100644 documentation/cli/vela_deployment_run.md create mode 100644 documentation/cli/vela_env_ls.md create mode 100644 documentation/cli/vela_env_set.md delete mode 100644 documentation/cli/vela_env_sw.md create mode 100644 documentation/cli/vela_logs.md create mode 100644 documentation/cli/vela_manualscaler.md delete mode 100644 documentation/cli/vela_rollout_detach.md delete mode 100644 documentation/cli/vela_scale_detach.md create mode 100644 documentation/cli/vela_system.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad9029b5c..a0ebeab77 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -80,10 +80,10 @@ Trait env init Create env succeed, current env is default • ------------------------------ -Trait env switch - should show env switch message +Trait env set + should show env set message kubevela/e2e/commonContext.go:40 -Switch env succeed, current env is default +Set env succeed, current env is default • ------------------------------ Trait run diff --git a/README.md b/README.md index 15adca4fa..1bfe75349 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,8 @@ NAME CURRENT NAMESPACE default default test * test -$ vela env switch default -Switch env succeed, current env is default +$ vela env set default +Set env succeed, current env is default $ vela env delete test test deleted diff --git a/cmd/vela/main.go b/cmd/vela/main.go index 80f63a5bc..4de7d54ad 100644 --- a/cmd/vela/main.go +++ b/cmd/vela/main.go @@ -129,6 +129,7 @@ func newCommand() *cobra.Command { fset := flag.NewFlagSet("logs", flag.ContinueOnError) klog.InitFlags(fset) _ = fset.Set("v", "-1") + return cmds } diff --git a/documentation/api/vela-restful-api-reference.md b/documentation/api/vela-restful-api-reference.md index 86fab2c77..5e9513088 100644 --- a/documentation/api/vela-restful-api-reference.md +++ b/documentation/api/vela-restful-api-reference.md @@ -103,11 +103,11 @@ sample response } ``` -### PATCH /api/envs/:envName (env switch) +### PATCH /api/envs/:envName (env set) - example sample response ```json -{"code":200,"data":"Switch env succeed"} +{"code":200,"data":"Set env succeed"} ``` ```json diff --git a/documentation/cli/vela.md b/documentation/cli/vela.md index 9f450df92..ef9fbb706 100644 --- a/documentation/cli/vela.md +++ b/documentation/cli/vela.md @@ -19,32 +19,20 @@ vela [flags] ### SEE ALSO -* [vela app delete](vela_app_delete.md) - Delete OAM Applications -* [vela app ls](vela_app_ls.md) - List applications -* [vela app run](vela_app_run.md) - Run a bundle of OAM Applications -* [vela app show](vela_app_show.md) - get detail spec of your app -* [vela app status](vela_app_status.md) - get status of an application -* [vela cap add](vela_cap_add.md) - Add capability into cluster -* [vela cap center config](vela_cap_center_config.md) - Configure or add the capability center, default is local (built-in capabilities) -* [vela cap center sync](vela_cap_center_sync.md) - Sync capabilities from remote center, default to sync all centers -* [vela cap ls](vela_cap_ls.md) - List all capabilities in center -* [vela cap remove](vela_cap_remove.md) - Remove capability from cluster +* [vela app](vela_app.md) - Manage applications +* [vela cap](vela_cap.md) - Capability Management +* [vela comp](vela_comp.md) - Manage Components * [vela completion](vela_completion.md) - Output shell completion code for the specified shell (bash or zsh) -* [vela comp run](vela_comp_run.md) - Run containerized workloads * [vela dashboard](vela_dashboard.md) - Setup API Server and launch Dashboard -* [vela env](vela_env.md) - List environments -* [vela env delete](vela_env_delete.md) - Delete environment -* [vela env init](vela_env_init.md) - Create environments -* [vela env sw](vela_env_sw.md) - Switch environments +* [vela env](vela_env.md) - Manage application environments +* [vela install](vela_install.md) - Initialize vela on both client and server +* [vela logs](vela_logs.md) - Tail pods logs of an application +* [vela manualscaler](vela_manualscaler.md) - Attach manualscaler trait to an app * [vela rollout](vela_rollout.md) - Attach rollout trait to an app -* [vela rollout:detach](vela_rollout_detach.md) - Detach rollout trait from an app * [vela scale](vela_scale.md) - Attach scale trait to an app -* [vela scale:detach](vela_scale_detach.md) - Detach scale trait from an app -* [vela system:info](vela_system_info.md) - show vela client and cluster version -* [vela install](vela_system_init.md) - Initialize vela on both client and server -* [vela system update](vela_system_update.md) - Sync definition from cluster +* [vela system](vela_system.md) - system management utilities * [vela traits](vela_traits.md) - List traits * [vela version](vela_version.md) - Prints out build version information * [vela workloads](vela_workloads.md) - List workloads -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_app.md b/documentation/cli/vela_app.md new file mode 100644 index 000000000..d065284b0 --- /dev/null +++ b/documentation/cli/vela_app.md @@ -0,0 +1,36 @@ +## vela app + +Manage applications + +### Synopsis + +Manage applications with ls, show, delete, run + +### Examples + +``` +vela app +``` + +### Options + +``` + -h, --help help for app +``` + +### Options inherited from parent commands + +``` + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela](vela.md) - +* [vela app delete](vela_app_delete.md) - Delete Applications +* [vela app ls](vela_app_ls.md) - List applications +* [vela app run](vela_app_run.md) - Run a bundle of OAM Applications +* [vela app show](vela_app_show.md) - get details of your app +* [vela app status](vela_app_status.md) - get status of an application + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_app_delete.md b/documentation/cli/vela_app_delete.md index 96303a55c..4d379df8b 100644 --- a/documentation/cli/vela_app_delete.md +++ b/documentation/cli/vela_app_delete.md @@ -1,10 +1,10 @@ ## vela app delete -Delete OAM Applications +Delete Applications ### Synopsis -Delete OAM Applications +Delete Applications ``` vela app delete @@ -13,13 +13,13 @@ vela app delete ### Examples ``` -vela delete frontend +vela app delete frontend ``` ### Options ``` - -h, --help help for app delete + -h, --help help for delete ``` ### Options inherited from parent commands @@ -30,6 +30,6 @@ vela delete frontend ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela app](vela_app.md) - Manage applications -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_app_ls.md b/documentation/cli/vela_app_ls.md index 9e7e6f208..ff86496bf 100644 --- a/documentation/cli/vela_app_ls.md +++ b/documentation/cli/vela_app_ls.md @@ -20,7 +20,7 @@ vela app ls ``` -a, --app string Application name - -h, --help help for app ls + -h, --help help for ls ``` ### Options inherited from parent commands @@ -31,6 +31,6 @@ vela app ls ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela app](vela_app.md) - Manage applications -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_app_run.md b/documentation/cli/vela_app_run.md index d0ca2bee8..317dd998f 100644 --- a/documentation/cli/vela_app_run.md +++ b/documentation/cli/vela_app_run.md @@ -13,14 +13,14 @@ vela app run [args] ### Examples ``` -vela run myAppBundle +vela app run myAppBundle ``` ### Options ``` -f, --file string launch application from provided appfile - -h, --help help for app run + -h, --help help for run ``` ### Options inherited from parent commands @@ -31,6 +31,6 @@ vela run myAppBundle ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela app](vela_app.md) - Manage applications -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_app_show.md b/documentation/cli/vela_app_show.md index e1eaa02ff..c16fe179f 100644 --- a/documentation/cli/vela_app_show.md +++ b/documentation/cli/vela_app_show.md @@ -1,10 +1,10 @@ ## vela app show -get detail spec of your app +get details of your app ### Synopsis -get detail spec of your app, including its workload and trait +get details of your app, including its workload and trait ``` vela app show [flags] @@ -19,7 +19,7 @@ vela app show ### Options ``` - -h, --help help for app show + -h, --help help for show ``` ### Options inherited from parent commands @@ -30,6 +30,6 @@ vela app show ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela app](vela_app.md) - Manage applications -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_app_status.md b/documentation/cli/vela_app_status.md index 7772f08b3..b682ae80b 100644 --- a/documentation/cli/vela_app_status.md +++ b/documentation/cli/vela_app_status.md @@ -4,7 +4,7 @@ get status of an application ### Synopsis -get status of an application, including its workload and trait +get status of an application, including workloads and traits of each components. ``` vela app status [flags] @@ -13,13 +13,13 @@ vela app status [flags] ### Examples ``` -vela app status +vela status ``` ### Options ``` - -h, --help help for app status + -h, --help help for status ``` ### Options inherited from parent commands @@ -30,6 +30,6 @@ vela app status ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela app](vela_app.md) - Manage applications -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_cap.md b/documentation/cli/vela_cap.md new file mode 100644 index 000000000..04c2937ea --- /dev/null +++ b/documentation/cli/vela_cap.md @@ -0,0 +1,29 @@ +## vela cap + +Capability Management + +### Synopsis + +Capability Management with config, list, add, remove capabilities + +### Options + +``` + -h, --help help for cap +``` + +### Options inherited from parent commands + +``` + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela](vela.md) - +* [vela cap add](vela_cap_add.md) - Add capability into cluster +* [vela cap center](vela_cap_center.md) - Manage Capability Center +* [vela cap ls](vela_cap_ls.md) - List all capabilities in center +* [vela cap remove](vela_cap_remove.md) - Remove capability from cluster + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_cap_add.md b/documentation/cli/vela_cap_add.md index 7fdaeb804..e647d962e 100644 --- a/documentation/cli/vela_cap_add.md +++ b/documentation/cli/vela_cap_add.md @@ -19,7 +19,7 @@ vela cap add mycenter/route ### Options ``` - -h, --help help for cap add + -h, --help help for add -t, --token string Github Repo token ``` @@ -31,6 +31,6 @@ vela cap add mycenter/route ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela cap](vela_cap.md) - Capability Management -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_cap_center.md b/documentation/cli/vela_cap_center.md new file mode 100644 index 000000000..3ac09b8df --- /dev/null +++ b/documentation/cli/vela_cap_center.md @@ -0,0 +1,29 @@ +## vela cap center + +Manage Capability Center + +### Synopsis + +Manage Capability Center with config, sync, list + +### Options + +``` + -h, --help help for center +``` + +### Options inherited from parent commands + +``` + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela cap](vela_cap.md) - Capability Management +* [vela cap center config](vela_cap_center_config.md) - Configure or add the capability center, default is local (built-in capabilities) +* [vela cap center ls](vela_cap_center_ls.md) - List all capability centers +* [vela cap center remove](vela_cap_center_remove.md) - Remove specified capability center +* [vela cap center sync](vela_cap_center_sync.md) - Sync capabilities from remote center, default to sync all centers + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_cap_center_config.md b/documentation/cli/vela_cap_center_config.md index 23dd3e386..abdbddb7d 100644 --- a/documentation/cli/vela_cap_center_config.md +++ b/documentation/cli/vela_cap_center_config.md @@ -7,7 +7,7 @@ Configure or add the capability center, default is local (built-in capabilities) Configure or add the capability center, default is local (built-in capabilities) ``` -vela cap center config [flags] +vela cap center config [flags] ``` ### Examples @@ -19,7 +19,7 @@ vela cap center config mycenter https://github.com/oam-dev/catalog/cap-center ### Options ``` - -h, --help help for cap center config + -h, --help help for config -t, --token string Github Repo token ``` @@ -31,6 +31,6 @@ vela cap center config mycenter https://github.com/oam-dev/catalog/cap-center ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela cap center](vela_cap_center.md) - Manage Capability Center -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_cap_center_ls.md b/documentation/cli/vela_cap_center_ls.md new file mode 100644 index 000000000..08e9db46f --- /dev/null +++ b/documentation/cli/vela_cap_center_ls.md @@ -0,0 +1,35 @@ +## vela cap center ls + +List all capability centers + +### Synopsis + +List all configured capability centers + +``` +vela cap center ls [flags] +``` + +### Examples + +``` +vela cap center ls +``` + +### Options + +``` + -h, --help help for ls +``` + +### Options inherited from parent commands + +``` + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela cap center](vela_cap_center.md) - Manage Capability Center + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_cap_center_remove.md b/documentation/cli/vela_cap_center_remove.md new file mode 100644 index 000000000..df650513b --- /dev/null +++ b/documentation/cli/vela_cap_center_remove.md @@ -0,0 +1,35 @@ +## vela cap center remove + +Remove specified capability center + +### Synopsis + +Remove specified capability center + +``` +vela cap center remove [flags] +``` + +### Examples + +``` +vela cap center remove mycenter +``` + +### Options + +``` + -h, --help help for remove +``` + +### Options inherited from parent commands + +``` + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela cap center](vela_cap_center.md) - Manage Capability Center + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_cap_center_sync.md b/documentation/cli/vela_cap_center_sync.md index c17656aef..1cae04919 100644 --- a/documentation/cli/vela_cap_center_sync.md +++ b/documentation/cli/vela_cap_center_sync.md @@ -19,7 +19,7 @@ vela cap center sync mycenter ### Options ``` - -h, --help help for cap center sync + -h, --help help for sync ``` ### Options inherited from parent commands @@ -30,6 +30,6 @@ vela cap center sync mycenter ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela cap center](vela_cap_center.md) - Manage Capability Center -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_cap_ls.md b/documentation/cli/vela_cap_ls.md index 57df19684..a3727ddff 100644 --- a/documentation/cli/vela_cap_ls.md +++ b/documentation/cli/vela_cap_ls.md @@ -19,7 +19,7 @@ vela cap ls ### Options ``` - -h, --help help for cap ls + -h, --help help for ls ``` ### Options inherited from parent commands @@ -30,6 +30,6 @@ vela cap ls ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela cap](vela_cap.md) - Capability Management -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_cap_remove.md b/documentation/cli/vela_cap_remove.md index 43bf68f09..be0b3c966 100644 --- a/documentation/cli/vela_cap_remove.md +++ b/documentation/cli/vela_cap_remove.md @@ -19,7 +19,7 @@ vela cap remove route ### Options ``` - -h, --help help for cap remove + -h, --help help for remove -t, --token string Github Repo token ``` @@ -31,6 +31,6 @@ vela cap remove route ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela cap](vela_cap.md) - Capability Management -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_comp.md b/documentation/cli/vela_comp.md new file mode 100644 index 000000000..fbaf97b24 --- /dev/null +++ b/documentation/cli/vela_comp.md @@ -0,0 +1,31 @@ +## vela comp + +Manage Components + +### Synopsis + +Manage Components + +### Options + +``` + -a, --app string specify application name for component + -h, --help help for comp +``` + +### Options inherited from parent commands + +``` + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela](vela.md) - +* [vela comp delete](vela_comp_delete.md) - Delete Component From Application +* [vela comp ls](vela_comp_ls.md) - List applications +* [vela comp run](vela_comp_run.md) - Init and Run workloads +* [vela comp show](vela_comp_show.md) - get component detail +* [vela comp status](vela_comp_status.md) - get status of a component + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_comp_delete.md b/documentation/cli/vela_comp_delete.md new file mode 100644 index 000000000..51a7ffefb --- /dev/null +++ b/documentation/cli/vela_comp_delete.md @@ -0,0 +1,36 @@ +## vela comp delete + +Delete Component From Application + +### Synopsis + +Delete Component From Application + +``` +vela comp delete +``` + +### Examples + +``` +vela comp delete frontend +``` + +### Options + +``` + -h, --help help for delete +``` + +### Options inherited from parent commands + +``` + -a, --app string specify application name for component + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela comp](vela_comp.md) - Manage Components + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_comp_ls.md b/documentation/cli/vela_comp_ls.md new file mode 100644 index 000000000..dfdcf022e --- /dev/null +++ b/documentation/cli/vela_comp_ls.md @@ -0,0 +1,36 @@ +## vela comp ls + +List applications + +### Synopsis + +List applications with workloads, traits, status and created time + +``` +vela comp ls +``` + +### Examples + +``` +vela comp ls +``` + +### Options + +``` + -h, --help help for ls +``` + +### Options inherited from parent commands + +``` + -a, --app string specify application name for component + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela comp](vela_comp.md) - Manage Components + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_comp_run.md b/documentation/cli/vela_comp_run.md index 8586a068c..a90d5bc3f 100644 --- a/documentation/cli/vela_comp_run.md +++ b/documentation/cli/vela_comp_run.md @@ -1,40 +1,38 @@ ## vela comp run -Run containerized workloads +Init and Run workloads ### Synopsis -Run containerized workloads +Init and Run workloads ``` -vela comp run -t [args] +vela comp run [args] ``` ### Examples ``` -vela comp run -t containerized frontend +vela comp run -t ``` ### Options ``` - -a, --app string create or add into an existing application group - -h, --help help for comp run - -i, --image string specify app image - --name string - -p, --port int specify port for container (default 6379) - -s, --staging only save changes locally without real update application + -h, --help help for run + -s, --staging only save changes locally without real update application + -t, --type string specify workload type for application ``` ### Options inherited from parent commands ``` + -a, --app string specify application name for component -e, --env string specify env name for application ``` ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela comp](vela_comp.md) - Manage Components -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_comp_show.md b/documentation/cli/vela_comp_show.md new file mode 100644 index 000000000..7f43887c7 --- /dev/null +++ b/documentation/cli/vela_comp_show.md @@ -0,0 +1,36 @@ +## vela comp show + +get component detail + +### Synopsis + +get component detail, including arguments of workload and trait + +``` +vela comp show [flags] +``` + +### Examples + +``` +vela comp show +``` + +### Options + +``` + -h, --help help for show +``` + +### Options inherited from parent commands + +``` + -a, --app string specify application name for component + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela comp](vela_comp.md) - Manage Components + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_comp_status.md b/documentation/cli/vela_comp_status.md new file mode 100644 index 000000000..5f40ab93f --- /dev/null +++ b/documentation/cli/vela_comp_status.md @@ -0,0 +1,36 @@ +## vela comp status + +get status of a component + +### Synopsis + +get status of a component, including its workload and health status + +``` +vela comp status [flags] +``` + +### Examples + +``` +vela comp status +``` + +### Options + +``` + -h, --help help for status +``` + +### Options inherited from parent commands + +``` + -a, --app string specify application name for component + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela comp](vela_comp.md) - Manage Components + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_completion.md b/documentation/cli/vela_completion.md index c20a62bee..192c5920f 100644 --- a/documentation/cli/vela_completion.md +++ b/documentation/cli/vela_completion.md @@ -23,8 +23,8 @@ of vela commands. ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela](vela.md) - * [vela completion bash](vela_completion_bash.md) - generate autocompletions script for bash * [vela completion zsh](vela_completion_zsh.md) - generate autocompletions script for zsh -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_completion_bash.md b/documentation/cli/vela_completion_bash.md index c95e9736e..7a4c2eda6 100644 --- a/documentation/cli/vela_completion_bash.md +++ b/documentation/cli/vela_completion_bash.md @@ -36,4 +36,4 @@ vela completion bash * [vela completion](vela_completion.md) - Output shell completion code for the specified shell (bash or zsh) -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_completion_zsh.md b/documentation/cli/vela_completion_zsh.md index 6e62b4c3e..c6dd708b0 100644 --- a/documentation/cli/vela_completion_zsh.md +++ b/documentation/cli/vela_completion_zsh.md @@ -33,4 +33,4 @@ vela completion zsh * [vela completion](vela_completion.md) - Output shell completion code for the specified shell (bash or zsh) -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_dashboard.md b/documentation/cli/vela_dashboard.md index 1bd7bc6de..cbcf19bda 100644 --- a/documentation/cli/vela_dashboard.md +++ b/documentation/cli/vela_dashboard.md @@ -19,7 +19,13 @@ dashboard ### Options ``` - -h, --help help for dashboard + --development Development mode. (default true) + -h, --help help for dashboard + --log-compress Enable compression on the rotated logs. (default true) + --log-file-path string The log file path. + --log-retain-date int The number of days of logs history to retain. (default 7) + --port string specify port for dashboard (default ":38081") + --static string specify local static file directory ``` ### Options inherited from parent commands @@ -30,6 +36,6 @@ dashboard ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela](vela.md) - -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_deployment_run.md b/documentation/cli/vela_deployment_run.md deleted file mode 100644 index 818c52c3d..000000000 --- a/documentation/cli/vela_deployment_run.md +++ /dev/null @@ -1,40 +0,0 @@ -## vela deployment:run - -Run deployment workloads - -### Synopsis - -Run deployment workloads - -``` -vela deployment:run [args] -``` - -### Examples - -``` -vela deployment:run frontend -``` - -### Options - -``` - -a, --app string create or add into an existing application group - -h, --help help for deployment:run - --image string - --name string - --port int (default 8080) - -s, --staging only save changes locally without real update application -``` - -### Options inherited from parent commands - -``` - -e, --env string specify env name for application -``` - -### SEE ALSO - -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. - -###### Auto generated by spf13/cobra on 17-Aug-2020 diff --git a/documentation/cli/vela_env.md b/documentation/cli/vela_env.md index d0855eed1..05dc59a75 100644 --- a/documentation/cli/vela_env.md +++ b/documentation/cli/vela_env.md @@ -1,20 +1,10 @@ ## vela env -List environments +Manage application environments ### Synopsis -List all environments - -``` -vela env ls -``` - -### Examples - -``` -vela env ls [env-name] -``` +Manage application environments ### Options @@ -30,6 +20,10 @@ vela env ls [env-name] ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela](vela.md) - +* [vela env delete](vela_env_delete.md) - Delete environment +* [vela env init](vela_env_init.md) - Create environments +* [vela env ls](vela_env_ls.md) - List environments +* [vela env set](vela_env_set.md) - Set an environment -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_env_delete.md b/documentation/cli/vela_env_delete.md index c433be3fc..fcbcf5998 100644 --- a/documentation/cli/vela_env_delete.md +++ b/documentation/cli/vela_env_delete.md @@ -19,7 +19,7 @@ vela env delete test ### Options ``` - -h, --help help for env delete + -h, --help help for delete ``` ### Options inherited from parent commands @@ -30,6 +30,6 @@ vela env delete test ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela env](vela_env.md) - Manage application environments -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_env_init.md b/documentation/cli/vela_env_init.md index 1f99d89ee..e774448b3 100644 --- a/documentation/cli/vela_env_init.md +++ b/documentation/cli/vela_env_init.md @@ -4,7 +4,7 @@ Create environments ### Synopsis -Create environment and switch to it +Create environment and set the currently using environment ``` vela env init @@ -19,7 +19,7 @@ vela env init test --namespace test ### Options ``` - -h, --help help for env init + -h, --help help for init --namespace string specify K8s namespace for env (default "default") ``` @@ -31,6 +31,6 @@ vela env init test --namespace test ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela env](vela_env.md) - Manage application environments -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_env_ls.md b/documentation/cli/vela_env_ls.md new file mode 100644 index 000000000..295d69b52 --- /dev/null +++ b/documentation/cli/vela_env_ls.md @@ -0,0 +1,35 @@ +## vela env ls + +List environments + +### Synopsis + +List all environments + +``` +vela env ls +``` + +### Examples + +``` +vela env list [env-name] +``` + +### Options + +``` + -h, --help help for ls +``` + +### Options inherited from parent commands + +``` + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela env](vela_env.md) - Manage application environments + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_env_set.md b/documentation/cli/vela_env_set.md new file mode 100644 index 000000000..8f08b2d05 --- /dev/null +++ b/documentation/cli/vela_env_set.md @@ -0,0 +1,35 @@ +## vela env set + +Set an environment + +### Synopsis + +Set an environment as the current using one + +``` +vela env set +``` + +### Examples + +``` +vela env set test +``` + +### Options + +``` + -h, --help help for set +``` + +### Options inherited from parent commands + +``` + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela env](vela_env.md) - Manage application environments + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_env_sw.md b/documentation/cli/vela_env_sw.md deleted file mode 100644 index 98ef24364..000000000 --- a/documentation/cli/vela_env_sw.md +++ /dev/null @@ -1,35 +0,0 @@ -## vela env sw - -Switch environments - -### Synopsis - -switch to another environment - -``` -vela env sw -``` - -### Examples - -``` -vela env sw test -``` - -### Options - -``` - -h, --help help for env sw -``` - -### Options inherited from parent commands - -``` - -e, --env string specify env name for application -``` - -### SEE ALSO - -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. - -###### Auto generated by spf13/cobra on 17-Aug-2020 diff --git a/documentation/cli/vela_install.md b/documentation/cli/vela_install.md index 0857214af..ad83af136 100644 --- a/documentation/cli/vela_install.md +++ b/documentation/cli/vela_install.md @@ -13,8 +13,8 @@ vela install [flags] ### Options ``` - -h, --help help for install - -v, --version string Override chart version + -h, --help help for install + -p, --vela-chart-path string path to vela core chart to override default chart ``` ### Options inherited from parent commands @@ -25,6 +25,6 @@ vela install [flags] ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela](vela.md) - -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_logs.md b/documentation/cli/vela_logs.md new file mode 100644 index 000000000..ccb67a3e9 --- /dev/null +++ b/documentation/cli/vela_logs.md @@ -0,0 +1,29 @@ +## vela logs + +Tail pods logs of an application + +### Synopsis + +Tail pods logs of an application + +``` +vela logs [flags] +``` + +### Options + +``` + -h, --help help for logs +``` + +### Options inherited from parent commands + +``` + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela](vela.md) - + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_manualscaler.md b/documentation/cli/vela_manualscaler.md new file mode 100644 index 000000000..b8cb1b374 --- /dev/null +++ b/documentation/cli/vela_manualscaler.md @@ -0,0 +1,39 @@ +## vela manualscaler + +Attach manualscaler trait to an app + +### Synopsis + +Attach manualscaler trait to an app + +``` +vela manualscaler [args] +``` + +### Examples + +``` +vela manualscaler frontend +``` + +### Options + +``` + -a, --app string create or add into an existing application group + --detach detach trait from component + -h, --help help for manualscaler + -r, --replica int (default 2) + -s, --staging only save changes locally without real update application +``` + +### Options inherited from parent commands + +``` + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela](vela.md) - + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_rollout.md b/documentation/cli/vela_rollout.md index cf17ed6ae..3073903a0 100644 --- a/documentation/cli/vela_rollout.md +++ b/documentation/cli/vela_rollout.md @@ -21,6 +21,7 @@ vela rollout frontend ``` -a, --app string create or add into an existing application group --batch int (default 2) + --detach detach trait from component -h, --help help for rollout --maxUnavailable int (default 1) --replica int (default 3) @@ -35,6 +36,6 @@ vela rollout frontend ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela](vela.md) - -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_rollout_detach.md b/documentation/cli/vela_rollout_detach.md deleted file mode 100644 index 463167efd..000000000 --- a/documentation/cli/vela_rollout_detach.md +++ /dev/null @@ -1,37 +0,0 @@ -## vela rollout:detach - -Detach rollout trait from an app - -### Synopsis - -Detach rollout trait from an app - -``` -vela rollout:detach -``` - -### Examples - -``` -vela rollout:detach frontend -``` - -### Options - -``` - -a, --app string create or add into an existing application group - -h, --help help for rollout:detach - -s, --staging only save changes locally without real update application -``` - -### Options inherited from parent commands - -``` - -e, --env string specify env name for application -``` - -### SEE ALSO - -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. - -###### Auto generated by spf13/cobra on 17-Aug-2020 diff --git a/documentation/cli/vela_scale.md b/documentation/cli/vela_scale.md index e7f20f868..eb1e6cc55 100644 --- a/documentation/cli/vela_scale.md +++ b/documentation/cli/vela_scale.md @@ -20,6 +20,7 @@ vela scale frontend ``` -a, --app string create or add into an existing application group + --detach detach trait from component -h, --help help for scale -r, --replica int (default 2) -s, --staging only save changes locally without real update application @@ -33,6 +34,6 @@ vela scale frontend ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela](vela.md) - -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_scale_detach.md b/documentation/cli/vela_scale_detach.md deleted file mode 100644 index 369bad06d..000000000 --- a/documentation/cli/vela_scale_detach.md +++ /dev/null @@ -1,37 +0,0 @@ -## vela scale:detach - -Detach scale trait from an app - -### Synopsis - -Detach scale trait from an app - -``` -vela scale:detach -``` - -### Examples - -``` -vela scale:detach frontend -``` - -### Options - -``` - -a, --app string create or add into an existing application group - -h, --help help for scale:detach - -s, --staging only save changes locally without real update application -``` - -### Options inherited from parent commands - -``` - -e, --env string specify env name for application -``` - -### SEE ALSO - -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. - -###### Auto generated by spf13/cobra on 17-Aug-2020 diff --git a/documentation/cli/vela_system.md b/documentation/cli/vela_system.md new file mode 100644 index 000000000..dee5943b6 --- /dev/null +++ b/documentation/cli/vela_system.md @@ -0,0 +1,27 @@ +## vela system + +system management utilities + +### Synopsis + +system management utilities + +### Options + +``` + -h, --help help for system +``` + +### Options inherited from parent commands + +``` + -e, --env string specify env name for application +``` + +### SEE ALSO + +* [vela](vela.md) - +* [vela system info](vela_system_info.md) - show vela client and cluster chartPath +* [vela system update](vela_system_update.md) - Sync definition from cluster + +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_system_info.md b/documentation/cli/vela_system_info.md index d17406821..7ba129dfd 100644 --- a/documentation/cli/vela_system_info.md +++ b/documentation/cli/vela_system_info.md @@ -1,19 +1,19 @@ -## vela system:info +## vela system info -show vela client and cluster version +show vela client and cluster chartPath ### Synopsis -show vela client and cluster version +show vela client and cluster chartPath ``` -vela system:info [flags] +vela system info [flags] ``` ### Options ``` - -h, --help help for system:info + -h, --help help for info ``` ### Options inherited from parent commands @@ -24,6 +24,6 @@ vela system:info [flags] ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela system](vela_system.md) - system management utilities -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_system_update.md b/documentation/cli/vela_system_update.md index 37448b0c9..7e04c4657 100644 --- a/documentation/cli/vela_system_update.md +++ b/documentation/cli/vela_system_update.md @@ -19,7 +19,7 @@ vela system update ### Options ``` - -h, --help help for system update + -h, --help help for update ``` ### Options inherited from parent commands @@ -30,6 +30,6 @@ vela system update ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela system](vela_system.md) - system management utilities -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_traits.md b/documentation/cli/vela_traits.md index 2dff5b353..6b5cf13d5 100644 --- a/documentation/cli/vela_traits.md +++ b/documentation/cli/vela_traits.md @@ -31,6 +31,6 @@ vela traits ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela](vela.md) - -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_version.md b/documentation/cli/vela_version.md index da9968e22..0529a1920 100644 --- a/documentation/cli/vela_version.md +++ b/documentation/cli/vela_version.md @@ -24,6 +24,6 @@ vela version [flags] ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela](vela.md) - -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/documentation/cli/vela_workloads.md b/documentation/cli/vela_workloads.md index bd3c22a99..c0f23fa16 100644 --- a/documentation/cli/vela_workloads.md +++ b/documentation/cli/vela_workloads.md @@ -30,6 +30,6 @@ vela workloads ### SEE ALSO -* [vela](vela.md) - ✈️ A Micro App Platform for Kubernetes. +* [vela](vela.md) - -###### Auto generated by spf13/cobra on 17-Aug-2020 +###### Auto generated by spf13/cobra on 11-Sep-2020 diff --git a/e2e/apiserver/apiserver_test.go b/e2e/apiserver/apiserver_test.go index 300e506c0..1b47456a6 100644 --- a/e2e/apiserver/apiserver_test.go +++ b/e2e/apiserver/apiserver_test.go @@ -76,8 +76,8 @@ var _ = ginkgo.Describe("API", func() { e2e.APIEnvInitContext("post /envs/", envWorldMeta) - ginkgo.Context("switch /envs/:envName", func() { - ginkgo.It("should switch an env", func() { + ginkgo.Context("set /envs/:envName", func() { + ginkgo.It("should set an env as the currently using one", func() { req, err := http.NewRequest("PATCH", util.URL("/envs/"+envHelloMeta.EnvName), nil) gomega.Expect(err).NotTo(gomega.HaveOccurred()) resp, err := http.DefaultClient.Do(req) @@ -89,7 +89,7 @@ var _ = ginkgo.Describe("API", func() { err = json.Unmarshal(result, &r) gomega.Expect(err).NotTo(gomega.HaveOccurred()) gomega.Expect(http.StatusOK).To(gomega.Equal(r.Code)) - content := fmt.Sprintf("Switch env succeed, current env is " + envHelloMeta.EnvName) + content := fmt.Sprintf("Set env succeed, current env is " + envHelloMeta.EnvName) gomega.Expect(r.Data.(string)).To(gomega.ContainSubstring(content)) }) }) diff --git a/e2e/application/application_test.go b/e2e/application/application_test.go index 38eb0ec94..8ba10dfa3 100644 --- a/e2e/application/application_test.go +++ b/e2e/application/application_test.go @@ -18,7 +18,7 @@ var ( var _ = ginkgo.Describe("Application", func() { e2e.EnvInitContext("env init", envName) e2e.EnvShowContext("env show", envName) - e2e.EnvSwitchContext("env switch", envName) + e2e.EnvSetContext("env set", envName) e2e.WorkloadRunContext("run", fmt.Sprintf("vela comp run -t %s %s -p 80 --image nginx:1.9.4", workloadType, applicationName)) e2e.ComponentListContext("comp ls", applicationName, "") diff --git a/e2e/commonContext.go b/e2e/commonContext.go index 97d6270e2..13c41bfab 100644 --- a/e2e/commonContext.go +++ b/e2e/commonContext.go @@ -77,13 +77,13 @@ var ( }) } - EnvSwitchContext = func(context string, envName string) bool { + EnvSetContext = func(context string, envName string) bool { return ginkgo.Context(context, func() { - ginkgo.It("should show env switch message", func() { + ginkgo.It("should show env set message", func() { cli := fmt.Sprintf("vela env sw %s", envName) output, err := Exec(cli) gomega.Expect(err).NotTo(gomega.HaveOccurred()) - expectedOutput := fmt.Sprintf("Switch env succeed, current env is %s", envName) + expectedOutput := fmt.Sprintf("Set env succeed, current env is %s", envName) gomega.Expect(output).To(gomega.ContainSubstring(expectedOutput)) }) }) diff --git a/e2e/env/env_test.go b/e2e/env/env_test.go index c8d21e66f..c92d59c2f 100644 --- a/e2e/env/env_test.go +++ b/e2e/env/env_test.go @@ -17,7 +17,7 @@ var _ = ginkgo.Describe("Env", func() { e2e.EnvInitContext("env init", envName) e2e.EnvInitContext("env init another one", envName2) e2e.EnvShowContext("env show", envName) - e2e.EnvSwitchContext("env sw", envName) + e2e.EnvSetContext("env sw", envName) ginkgo.Context("env list", func() { ginkgo.It("should list all envs", func() { diff --git a/e2e/trait/trait_test.go b/e2e/trait/trait_test.go index a664858ce..2373630f0 100644 --- a/e2e/trait/trait_test.go +++ b/e2e/trait/trait_test.go @@ -19,7 +19,7 @@ var ( var _ = ginkgo.Describe("Trait", func() { e2e.RefreshContext("refresh") e2e.EnvInitContext("env init", envName) - e2e.EnvSwitchContext("env switch", envName) + e2e.EnvSetContext("env set", envName) e2e.WorkloadRunContext("run", fmt.Sprintf("vela comp run -t containerized %s -p 80 --image nginx:1.9.4", applicationName)) e2e.TraitManualScalerAttachContext("vela attach trait", traitAlias, applicationName) diff --git a/e2e/workload/workload_test.go b/e2e/workload/workload_test.go index 60f7cd24b..b418600d1 100644 --- a/e2e/workload/workload_test.go +++ b/e2e/workload/workload_test.go @@ -17,7 +17,7 @@ var ( var _ = ginkgo.Describe("Workload", func() { e2e.RefreshContext("refresh") e2e.EnvInitContext("env init", envName) - e2e.EnvSwitchContext("env switch", envName) + e2e.EnvSetContext("env set", envName) e2e.WorkloadRunContext("run", fmt.Sprintf("vela comp run -t containerized %s -p 80 --image nginx:1.9.4", applicationName)) ginkgo.Context("run without enough flags", func() { diff --git a/pkg/commands/env.go b/pkg/commands/env.go index 3be8a6848..a0fd3c804 100644 --- a/pkg/commands/env.go +++ b/pkg/commands/env.go @@ -26,7 +26,7 @@ func NewEnvCommand(c types.Args, ioStream cmdutil.IOStreams) *cobra.Command { }, } cmd.SetOut(ioStream.Out) - cmd.AddCommand(NewEnvListCommand(ioStream), NewEnvInitCommand(c, ioStream), NewEnvSwitchCommand(ioStream), NewEnvDeleteCommand(ioStream)) + cmd.AddCommand(NewEnvListCommand(ioStream), NewEnvInitCommand(c, ioStream), NewEnvSetCommand(ioStream), NewEnvDeleteCommand(ioStream)) return cmd } @@ -56,7 +56,7 @@ func NewEnvInitCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Command Use: "init ", DisableFlagsInUseLine: true, Short: "Create environments", - Long: "Create environment and switch to it", + Long: "Create environment and set the currently using environment", Example: `vela env init test --namespace test`, RunE: func(cmd *cobra.Command, args []string) error { newClient, err := client.New(c.Config, client.Options{Scheme: c.Schema}) @@ -93,17 +93,17 @@ func NewEnvDeleteCommand(ioStreams cmdutil.IOStreams) *cobra.Command { return cmd } -func NewEnvSwitchCommand(ioStreams cmdutil.IOStreams) *cobra.Command { +func NewEnvSetCommand(ioStreams cmdutil.IOStreams) *cobra.Command { ctx := context.Background() cmd := &cobra.Command{ - Use: "switch", + Use: "set", Aliases: []string{"sw"}, DisableFlagsInUseLine: true, - Short: "Switch environments", - Long: "switch to another environment", - Example: `vela env switch test`, + Short: "Set an environment", + Long: "Set an environment as the current using one", + Example: `vela env set test`, RunE: func(cmd *cobra.Command, args []string) error { - return SwitchEnv(ctx, args, ioStreams) + return SetEnv(ctx, args, ioStreams) }, Annotations: map[string]string{ types.TagCommandType: types.TypeStart, @@ -158,12 +158,12 @@ func CreateOrUpdateEnv(ctx context.Context, c client.Client, envArgs *types.EnvM return nil } -func SwitchEnv(ctx context.Context, args []string, ioStreams cmdutil.IOStreams) error { +func SetEnv(ctx context.Context, args []string, ioStreams cmdutil.IOStreams) error { if len(args) < 1 { return fmt.Errorf("you must specify env name for vela env command") } envName := args[0] - msg, err := oam.SwitchEnv(envName) + msg, err := oam.SetEnv(envName) if err != nil { return err } diff --git a/pkg/commands/env_test.go b/pkg/commands/env_test.go index 767d2f78e..bafb1e783 100644 --- a/pkg/commands/env_test.go +++ b/pkg/commands/env_test.go @@ -76,11 +76,11 @@ func TestENV(t *testing.T) { err = DeleteEnv(ctx, []string{"env1"}, ioStream) assert.Error(t, err) - // switch to default env - err = SwitchEnv(ctx, []string{"default"}, ioStream) + // set as default env + err = SetEnv(ctx, []string{"default"}, ioStream) assert.NoError(t, err) - // check switch success + // check env set success gotEnv, err = GetEnv(nil) assert.NoError(t, err) assert.Equal(t, &types.EnvMeta{ @@ -92,11 +92,11 @@ func TestENV(t *testing.T) { err = DeleteEnv(ctx, []string{"env1"}, ioStream) assert.NoError(t, err) - // can not switch to non-exist env - err = SwitchEnv(ctx, []string{"env1"}, ioStream) + // can not set as a non-exist env + err = SetEnv(ctx, []string{"env1"}, ioStream) assert.Error(t, err) - // switch success - err = SwitchEnv(ctx, []string{"default"}, ioStream) + // set success + err = SetEnv(ctx, []string{"default"}, ioStream) assert.NoError(t, err) } diff --git a/pkg/oam/env.go b/pkg/oam/env.go index 5cf22d212..fb52e279e 100644 --- a/pkg/oam/env.go +++ b/pkg/oam/env.go @@ -34,8 +34,8 @@ func GetEnvByName(name string) (*types.EnvMeta, error) { } //Create or update env. -//If it does not exist, create it and switch to the new env. -//If it exists, update it and switch to the new env. +//If it does not exist, create it and set to the new env. +//If it exists, update it and set to the new env. func CreateOrUpdateEnv(ctx context.Context, c client.Client, envName string, namespace string) (string, error) { var message = "" var envArgs = types.EnvMeta{ @@ -218,7 +218,7 @@ func DeleteEnv(envName string) (string, error) { return message, err } -func SwitchEnv(envName string) (string, error) { +func SetEnv(envName string) (string, error) { var msg string currentEnvPath, err := system.GetCurrentEnvPath() if err != nil { @@ -231,6 +231,6 @@ func SwitchEnv(envName string) (string, error) { if err = ioutil.WriteFile(currentEnvPath, []byte(envName), 0644); err != nil { return msg, err } - msg = fmt.Sprintf("Switch env succeed, current env is " + envName + ", namespace is " + envMeta.Namespace) + msg = fmt.Sprintf("Set env succeed, current env is " + envName + ", namespace is " + envMeta.Namespace) return msg, nil } diff --git a/pkg/server/handler/envHandlers.go b/pkg/server/handler/envHandlers.go index f1663e14e..f387cce27 100644 --- a/pkg/server/handler/envHandlers.go +++ b/pkg/server/handler/envHandlers.go @@ -70,9 +70,9 @@ func DeleteEnv(c *gin.Context) { util.AssembleResponse(c, msg, err) } -func SwitchEnv(c *gin.Context) { +func SetEnv(c *gin.Context) { envName := c.Param("envName") - ctrl.Log.Info("Patch a switch environment request", "envName", envName) - msg, err := oam.SwitchEnv(envName) + ctrl.Log.Info("Patch a set environment request", "envName", envName) + msg, err := oam.SetEnv(envName) util.AssembleResponse(c, msg, err) } diff --git a/pkg/server/route.go b/pkg/server/route.go index 203c05bcf..20f3354d9 100644 --- a/pkg/server/route.go +++ b/pkg/server/route.go @@ -54,7 +54,7 @@ func setupRoute(kubeClient client.Client, staticPath string) http.Handler { envs.GET("/:envName", handler.GetEnv) envs.GET("/", handler.ListEnv) envs.DELETE("/:envName", handler.DeleteEnv) - envs.PATCH("/:envName", handler.SwitchEnv) + envs.PATCH("/:envName", handler.SetEnv) // app related operation apps := envs.Group("/:envName/apps") {