Rename vela env switch to vela env set

Renaming and update cli documentation
Fix #235
This commit is contained in:
zzxwill
2020-09-11 19:33:13 +08:00
parent 97f4d516fb
commit bc3169a1b5
61 changed files with 659 additions and 315 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -129,6 +129,7 @@ func newCommand() *cobra.Command {
fset := flag.NewFlagSet("logs", flag.ContinueOnError)
klog.InitFlags(fset)
_ = fset.Set("v", "-1")
return cmds
}

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,36 @@
## vela app
Manage applications
### Synopsis
Manage applications with ls, show, delete, run
### Examples
```
vela app <command>
```
### 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

View File

@@ -1,10 +1,10 @@
## vela app delete
Delete OAM Applications
Delete Applications
### Synopsis
Delete OAM Applications
Delete Applications
```
vela app delete <APPLICATION_NAME>
@@ -13,13 +13,13 @@ vela app delete <APPLICATION_NAME>
### 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

View File

@@ -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

View File

@@ -13,14 +13,14 @@ vela app run <APPLICATION_BUNDLE_NAME> [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

View File

@@ -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 <APPLICATION-NAME> [flags]
@@ -19,7 +19,7 @@ vela app show <APPLICATION-NAME>
### Options
```
-h, --help help for app show
-h, --help help for show
```
### Options inherited from parent commands
@@ -30,6 +30,6 @@ vela app show <APPLICATION-NAME>
### 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

View File

@@ -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 <APPLICATION-NAME> [flags]
@@ -13,13 +13,13 @@ vela app status <APPLICATION-NAME> [flags]
### Examples
```
vela app status <APPLICATION-NAME>
vela status <APPLICATION-NAME>
```
### Options
```
-h, --help help for app status
-h, --help help for status
```
### Options inherited from parent commands
@@ -30,6 +30,6 @@ vela app status <APPLICATION-NAME>
### 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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 <centerName> <centerUrl> [flags]
vela cap center config <centerName> <centerURL> [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

View File

@@ -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

View File

@@ -0,0 +1,35 @@
## vela cap center remove
Remove specified capability center
### Synopsis
Remove specified capability center
```
vela cap center remove <centerName> [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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,36 @@
## vela comp delete
Delete Component From Application
### Synopsis
Delete Component From Application
```
vela comp delete <ComponentName>
```
### 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

View File

@@ -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

View File

@@ -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 <workloadType> <appname> [args]
vela comp run [args]
```
### Examples
```
vela comp run -t containerized frontend
vela comp run -t <workload-type>
```
### 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

View File

@@ -0,0 +1,36 @@
## vela comp show
get component detail
### Synopsis
get component detail, including arguments of workload and trait
```
vela comp show <COMPONENT-NAME> [flags]
```
### Examples
```
vela comp show <COMPONENT-NAME>
```
### 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

View File

@@ -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 <COMPONENT-NAME> [flags]
```
### Examples
```
vela comp status <COMPONENT-NAME>
```
### 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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -1,40 +0,0 @@
## vela deployment:run
Run deployment workloads
### Synopsis
Run deployment workloads
```
vela deployment:run <appname> [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

View File

@@ -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

View File

@@ -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

View File

@@ -4,7 +4,7 @@ Create environments
### Synopsis
Create environment and switch to it
Create environment and set the currently using environment
```
vela env init <envName>
@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,29 @@
## vela logs
Tail pods logs of an application
### Synopsis
Tail pods logs of an application
```
vela logs <appname> [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

View File

@@ -0,0 +1,39 @@
## vela manualscaler
Attach manualscaler trait to an app
### Synopsis
Attach manualscaler trait to an app
```
vela manualscaler <appname> [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

View File

@@ -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

View File

@@ -1,37 +0,0 @@
## vela rollout:detach
Detach rollout trait from an app
### Synopsis
Detach rollout trait from an app
```
vela rollout:detach <appname>
```
### 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

View File

@@ -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

View File

@@ -1,37 +0,0 @@
## vela scale:detach
Detach scale trait from an app
### Synopsis
Detach scale trait from an app
```
vela scale:detach <appname>
```
### 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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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))
})
})

View File

@@ -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, "")

View File

@@ -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))
})
})

2
e2e/env/env_test.go vendored
View File

@@ -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() {

View File

@@ -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)

View File

@@ -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() {

View File

@@ -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 <envName>",
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
}

View File

@@ -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)
}

View File

@@ -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
}

View File

@@ -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)
}

View File

@@ -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")
{