mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-06 01:17:09 +00:00
Merge pull request #953 from wonderflow/svcd
deprecate unused vela commands
This commit is contained in:
@@ -15,7 +15,6 @@ vela [flags]
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [vela autoscale](vela_autoscale.md) - Attach autoscale trait to an app
|
||||
* [vela cap](vela_cap.md) - Manage capability centers and installing/uninstalling capabilities
|
||||
* [vela completion](vela_completion.md) - Output shell completion code for the specified shell (bash or zsh)
|
||||
* [vela config](vela_config.md) - Manage configurations
|
||||
@@ -27,14 +26,9 @@ vela [flags]
|
||||
* [vela install](vela_install.md) - Install Vela Core with built-in capabilities
|
||||
* [vela logs](vela_logs.md) - Tail logs for application
|
||||
* [vela ls](vela_ls.md) - List services
|
||||
* [vela metrics](vela_metrics.md) - Attach metrics trait to an app
|
||||
* [vela port-forward](vela_port-forward.md) - Forward local ports to services in an application
|
||||
* [vela rollout](vela_rollout.md) - Attach rollout trait to an app
|
||||
* [vela route](vela_route.md) - Attach route trait to an app
|
||||
* [vela scaler](vela_scaler.md) - Attach scaler trait to an app
|
||||
* [vela show](vela_show.md) - Show details of an application
|
||||
* [vela show](vela_show.md) - Show the reference doc for a workload type or trait
|
||||
* [vela status](vela_status.md) - Show status of an application
|
||||
* [vela svc](vela_svc.md) - Manage services
|
||||
* [vela system](vela_system.md) - System management utilities
|
||||
* [vela template](vela_template.md) - Manage templates
|
||||
* [vela traits](vela_traits.md) - List traits
|
||||
@@ -42,4 +36,4 @@ vela [flags]
|
||||
* [vela version](vela_version.md) - Prints out build version information
|
||||
* [vela workloads](vela_workloads.md) - List workloads
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
## vela autoscale
|
||||
|
||||
Attach autoscale trait to an app
|
||||
|
||||
### Synopsis
|
||||
|
||||
Attach autoscale trait to an app
|
||||
|
||||
```
|
||||
vela autoscale <appname> [args]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
vela autoscale frontend
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--cpu-percent int Specify the value for CPU utilization, like 80, which means 80%
|
||||
--detach detach trait from service
|
||||
-h, --help help for autoscale
|
||||
--max int Maximal replicas of the workload
|
||||
--min int Minimal replicas of the workload
|
||||
-s, --staging only save changes locally without real update application
|
||||
--svc string specify one service belonging to the application
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-e, --env string specify environment name for application
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
@@ -26,4 +26,4 @@ Manage capability centers and installing/uninstalling capabilities
|
||||
* [vela cap ls](vela_cap_ls.md) - List capabilities from cap-center
|
||||
* [vela cap uninstall](vela_cap_uninstall.md) - Uninstall capability from cluster
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -26,4 +26,4 @@ Manage Capability Center with config, sync, list
|
||||
* [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 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -33,4 +33,4 @@ vela cap center config mycenter https://github.com/oam-dev/catalog/cap-center
|
||||
|
||||
* [vela cap center](vela_cap_center.md) - Manage Capability Center
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela cap center ls
|
||||
|
||||
* [vela cap center](vela_cap_center.md) - Manage Capability Center
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela cap center remove mycenter
|
||||
|
||||
* [vela cap center](vela_cap_center.md) - Manage Capability Center
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela cap center sync mycenter
|
||||
|
||||
* [vela cap center](vela_cap_center.md) - Manage Capability Center
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -33,4 +33,4 @@ vela cap install mycenter/route
|
||||
|
||||
* [vela cap](vela_cap.md) - Manage capability centers and installing/uninstalling capabilities
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela cap ls
|
||||
|
||||
* [vela cap](vela_cap.md) - Manage capability centers and installing/uninstalling capabilities
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -33,4 +33,4 @@ vela cap uninstall route
|
||||
|
||||
* [vela cap](vela_cap.md) - Manage capability centers and installing/uninstalling capabilities
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -27,4 +27,4 @@ of vela commands.
|
||||
* [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 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -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 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -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 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -26,4 +26,4 @@ Manage configurations
|
||||
* [vela config ls](vela_config_ls.md) - List configs
|
||||
* [vela config set](vela_config_set.md) - Set data for a config
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela config del <config-name>
|
||||
|
||||
* [vela config](vela_config.md) - Manage configurations
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela config get <config-name>
|
||||
|
||||
* [vela config](vela_config.md) - Manage configurations
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela config ls
|
||||
|
||||
* [vela config](vela_config.md) - Manage configurations
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela config set <config-name> KEY=VALUE K2=V2
|
||||
|
||||
* [vela config](vela_config.md) - Manage configurations
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -33,4 +33,4 @@ vela delete frontend
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -26,4 +26,4 @@ Manage 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 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela env delete test
|
||||
|
||||
* [vela env](vela_env.md) - Manage environments
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -36,4 +36,4 @@ vela env init test --namespace test --email my@email.com
|
||||
|
||||
* [vela env](vela_env.md) - Manage environments
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela env ls [env-name]
|
||||
|
||||
* [vela env](vela_env.md) - Manage environments
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela env set test
|
||||
|
||||
* [vela env](vela_env.md) - Manage environments
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -16,6 +16,7 @@ vela exec [flags] APP_NAME -- COMMAND [args...]
|
||||
-h, --help help for exec
|
||||
--pod-running-timeout duration The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running (default 1m0s)
|
||||
-i, --stdin Pass stdin to the container (default true)
|
||||
-s, --svc string service name
|
||||
-t, --tty Stdin is a TTY (default true)
|
||||
```
|
||||
|
||||
@@ -29,4 +30,4 @@ vela exec [flags] APP_NAME -- COMMAND [args...]
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -27,4 +27,4 @@ vela export
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -33,4 +33,4 @@ vela init
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -17,6 +17,7 @@ vela install [flags]
|
||||
--image-pull-policy string vela core image pull policy, this will align to chart value image.pullPolicy
|
||||
--image-repo string vela core image repo, this will align to chart value image.repo
|
||||
--image-tag string vela core image repo, this will align to chart value image.tag
|
||||
-s, --set strings arguments for installing vela-core chart
|
||||
-p, --vela-chart-path string path to vela core chart to override default chart
|
||||
-w, --wait string wait until vela-core is ready to serve, default will not wait (default "0s")
|
||||
```
|
||||
@@ -31,4 +32,4 @@ vela install [flags]
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -27,4 +27,4 @@ vela logs [flags]
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -33,4 +33,4 @@ vela ls
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
## vela metrics
|
||||
|
||||
Attach metrics trait to an app
|
||||
|
||||
### Synopsis
|
||||
|
||||
Attach metrics trait to an app
|
||||
|
||||
```
|
||||
vela metrics <appname> [args]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
vela metrics frontend
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--detach detach trait from service
|
||||
--enabled (default true)
|
||||
-f, --format string Format of the metrics, default as prometheus (default "prometheus")
|
||||
-h, --help help for metrics
|
||||
--path string The metrics path of the service (default "/metrics")
|
||||
--port int The port for metrics, will discovery automatically by default
|
||||
--scheme http The way to retrieve data which can take the values http or `https` (default "http")
|
||||
-s, --staging only save changes locally without real update application
|
||||
--svc string specify one service belonging to the application
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-e, --env string specify environment name for application
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
@@ -35,4 +35,4 @@ port-forward APP_NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMO
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
## vela rollout
|
||||
|
||||
Attach rollout trait to an app
|
||||
|
||||
### Synopsis
|
||||
|
||||
Attach rollout trait to an app
|
||||
|
||||
```
|
||||
vela rollout <appname> [args]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
vela rollout frontend
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--detach detach trait from service
|
||||
-h, --help help for rollout
|
||||
--interval string Schedule interval time (default "30s")
|
||||
--replicas int Total replicas of the workload (default 2)
|
||||
-s, --staging only save changes locally without real update application
|
||||
--step-weight int Weight percent of every step in rolling update (default 50)
|
||||
--svc string specify one service belonging to the application
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-e, --env string specify environment name for application
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
@@ -1,40 +0,0 @@
|
||||
## vela route
|
||||
|
||||
Attach route trait to an app
|
||||
|
||||
### Synopsis
|
||||
|
||||
Attach route trait to an app
|
||||
|
||||
```
|
||||
vela route <appname> [args]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
vela route frontend
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--detach detach trait from service
|
||||
--domain string Domain name
|
||||
-h, --help help for route
|
||||
--issuer string
|
||||
-s, --staging only save changes locally without real update application
|
||||
--svc string specify one service belonging to the application
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-e, --env string specify environment name for application
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
@@ -1,39 +0,0 @@
|
||||
## vela scaler
|
||||
|
||||
Attach scaler trait to an app
|
||||
|
||||
### Synopsis
|
||||
|
||||
Attach scaler trait to an app
|
||||
|
||||
```
|
||||
vela scaler <appname> [args]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
vela scaler frontend
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--detach detach trait from service
|
||||
-h, --help help for scaler
|
||||
-r, --replicas int Replicas of the workload (default 1)
|
||||
-s, --staging only save changes locally without real update application
|
||||
--svc string specify one service belonging to the application
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-e, --env string specify environment name for application
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
@@ -1,26 +1,26 @@
|
||||
## vela show
|
||||
|
||||
Show details of an application
|
||||
Show the reference doc for a workload type or trait
|
||||
|
||||
### Synopsis
|
||||
|
||||
Show details of an application
|
||||
Show the reference doc for a workload type or trait
|
||||
|
||||
```
|
||||
vela show APP_NAME [flags]
|
||||
vela show [flags]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
vela show APP_NAME
|
||||
show webservice
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for show
|
||||
-s, --svc string service name
|
||||
-h, --help help for show
|
||||
--web start web doc site
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
@@ -33,4 +33,4 @@ vela show APP_NAME
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -33,4 +33,4 @@ vela status APP_NAME
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
## vela svc
|
||||
|
||||
Manage services
|
||||
|
||||
### Synopsis
|
||||
|
||||
Manage services
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-a, --app string specify the name of application containing the services
|
||||
-h, --help help for svc
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-e, --env string specify environment name for application
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [vela](vela.md) -
|
||||
* [vela svc deploy](vela_svc_deploy.md) - Initialize and run a service
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
@@ -1,38 +0,0 @@
|
||||
## vela svc deploy
|
||||
|
||||
Initialize and run a service
|
||||
|
||||
### Synopsis
|
||||
|
||||
Initialize and run a service. The app name would be the same as service name, if it's not specified.
|
||||
|
||||
```
|
||||
vela svc deploy [args]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
vela svc deploy -t <SERVICE_TYPE>
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for deploy
|
||||
-s, --staging only save changes locally without real update application
|
||||
-t, --type string specify workload type of the service
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-a, --app string specify the name of application containing the services
|
||||
-e, --env string specify environment name for application
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [vela svc](vela_svc.md) - Manage services
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
@@ -21,6 +21,7 @@ System management utilities
|
||||
### SEE ALSO
|
||||
|
||||
* [vela](vela.md) -
|
||||
* [vela system dry-run](vela_system_dry-run.md) - Dry Run an application, and output the conversion result to stdout
|
||||
* [vela system info](vela_system_info.md) - Show vela client and cluster chartPath
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
36
docs/en/cli/vela_system_dry-run.md
Normal file
36
docs/en/cli/vela_system_dry-run.md
Normal file
@@ -0,0 +1,36 @@
|
||||
## vela system dry-run
|
||||
|
||||
Dry Run an application, and output the conversion result to stdout
|
||||
|
||||
### Synopsis
|
||||
|
||||
Dry Run an application, and output the conversion result to stdout
|
||||
|
||||
```
|
||||
vela system dry-run
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
vela dry-run
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-f, --file string application file name (default "./app.yaml")
|
||||
-h, --help help for dry-run
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-e, --env string specify environment name for application
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [vela system](vela_system.md) - System management utilities
|
||||
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
@@ -26,4 +26,4 @@ vela system info [flags]
|
||||
|
||||
* [vela system](vela_system.md) - System management utilities
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -23,4 +23,4 @@ Manage templates
|
||||
* [vela](vela.md) -
|
||||
* [vela template context](vela_template_context.md) - Show context parameters
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -32,4 +32,4 @@ vela template context
|
||||
|
||||
* [vela template](vela_template.md) - Manage templates
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -19,6 +19,7 @@ vela traits
|
||||
### Options
|
||||
|
||||
```
|
||||
-r, -- Enforce refresh from cluster even if cache is not expired
|
||||
--apply-to string Workload name
|
||||
-h, --help help for traits
|
||||
-s, --sync Synchronize capabilities from cluster into local (default true)
|
||||
@@ -34,4 +35,4 @@ vela traits
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -27,4 +27,4 @@ vela up
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -26,4 +26,4 @@ vela version [flags]
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -19,6 +19,7 @@ vela workloads
|
||||
### Options
|
||||
|
||||
```
|
||||
-r, -- Enforce refresh from cluster even if cache is not expired
|
||||
-h, --help help for workloads
|
||||
-s, --sync Synchronize capabilities from cluster into local (default true)
|
||||
```
|
||||
@@ -33,4 +34,4 @@ vela workloads
|
||||
|
||||
* [vela](vela.md) -
|
||||
|
||||
###### Auto generated by spf13/cobra on 9-Dec-2020
|
||||
###### Auto generated by spf13/cobra on 28-Jan-2021
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/gomega"
|
||||
@@ -16,19 +15,6 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// SystemInitContext used for test install
|
||||
SystemInitContext = func(context string) bool {
|
||||
return ginkgo.Context(context, func() {
|
||||
ginkgo.It("Install OAM runtime and vela builtin capabilities.", func() {
|
||||
output, err := LongTimeExec("vela install --wait", 180*time.Second)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("- Installing OAM Kubernetes Runtime"))
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("- Installing builtin capabilities"))
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("Successful applied"))
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("Waiting KubeVela runtime ready to serve"))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// EnvInitContext used for test Env
|
||||
EnvInitContext = func(context string, envName string) bool {
|
||||
@@ -113,17 +99,6 @@ var (
|
||||
})
|
||||
}
|
||||
|
||||
//WorkloadRunContext used for test vela svc deploy
|
||||
WorkloadRunContext = func(context string, cli string) bool {
|
||||
return ginkgo.Context(context, func() {
|
||||
ginkgo.It("should print successful creation information", func() {
|
||||
output, err := Exec(cli)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("deployed"))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
WorkloadDeleteContext = func(context string, applicationName string) bool {
|
||||
return ginkgo.Context(context, func() {
|
||||
ginkgo.It("should print successful deletion information", func() {
|
||||
@@ -154,18 +129,6 @@ var (
|
||||
})
|
||||
})
|
||||
}
|
||||
// TraitManualScalerAttachContext used for test trait attach success
|
||||
TraitManualScalerAttachContext = func(context string, traitAlias string, applicationName string) bool {
|
||||
return ginkgo.Context(context, func() {
|
||||
ginkgo.It("should print successful attached information", func() {
|
||||
cli := fmt.Sprintf("vela %s %s", traitAlias, applicationName)
|
||||
output, err := LongTimeExec(cli, 180*time.Second)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("Adding " + traitAlias + " for app"))
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("Checking Status"))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// ComponentListContext used for test vela svc ls
|
||||
ComponentListContext = func(context string, applicationName string, workloadType string, traitAlias string) bool {
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
func TestApplication(t *testing.T) {
|
||||
gomega.RegisterFailHandler(ginkgo.Fail)
|
||||
ginkgo.RunSpecs(t, "System Suite")
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = ginkgo.Describe("Application", func() {
|
||||
// TODO(zzxwill) Need to find out why it failed in Github workflow.
|
||||
//e2e.SystemInitContext("install")
|
||||
})
|
||||
@@ -1,48 +1,11 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/gomega"
|
||||
|
||||
"github.com/oam-dev/kubevela/e2e"
|
||||
)
|
||||
|
||||
var (
|
||||
envName = "env-trait"
|
||||
applicationName = "app-trait-basic"
|
||||
applicationNotExistedName = "app-trait-basic-NOT-EXISTED"
|
||||
traitAlias = "scaler"
|
||||
serviceNameNotExisting = "svc-not-existing"
|
||||
)
|
||||
|
||||
var _ = ginkgo.Describe("Trait", func() {
|
||||
e2e.TraitCapabilityListContext()
|
||||
e2e.EnvInitContext("env init", envName)
|
||||
e2e.EnvSetContext("env set", envName)
|
||||
e2e.WorkloadRunContext("deploy", fmt.Sprintf("vela svc deploy -t webservice %s -p 80 --image nginx:1.9.4", applicationName))
|
||||
|
||||
e2e.TraitManualScalerAttachContext("vela attach trait", traitAlias, applicationName)
|
||||
|
||||
// Trait
|
||||
ginkgo.Context("vela attach trait to a not existing app", func() {
|
||||
ginkgo.It("should alert app not exist", func() {
|
||||
cli := fmt.Sprintf("vela %s %s", traitAlias, applicationNotExistedName)
|
||||
output, err := e2e.Exec(cli)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("the application " + applicationNotExistedName + " doesn't exist in current env " + envName))
|
||||
})
|
||||
})
|
||||
|
||||
ginkgo.Context("vela attach trait to a not existing service", func() {
|
||||
ginkgo.It("should alert service not exist", func() {
|
||||
cli := fmt.Sprintf("vela %s %s --svc %s", traitAlias, applicationName, serviceNameNotExisting)
|
||||
output, err := e2e.Exec(cli)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("the service " + serviceNameNotExisting + " doesn't exist in the application " + applicationName))
|
||||
})
|
||||
})
|
||||
|
||||
e2e.WorkloadDeleteContext("delete", applicationName)
|
||||
})
|
||||
|
||||
@@ -1,34 +1,11 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/gomega"
|
||||
|
||||
"github.com/oam-dev/kubevela/e2e"
|
||||
)
|
||||
|
||||
var (
|
||||
envName = "env-workload"
|
||||
applicationName = "app-workload-basic"
|
||||
notEnoughFlagsApplicationName = "app-workload-basic"
|
||||
)
|
||||
|
||||
var _ = ginkgo.Describe("Workload", func() {
|
||||
e2e.WorkloadCapabilityListContext()
|
||||
e2e.EnvInitContext("env init", envName)
|
||||
e2e.EnvSetContext("env set", envName)
|
||||
e2e.WorkloadRunContext("deploy", fmt.Sprintf("vela svc deploy -t webservice %s -p 80 --image nginx:1.9.4", applicationName))
|
||||
|
||||
ginkgo.Context("run without enough flags", func() {
|
||||
ginkgo.It("should throw error message: some flags are NOT set", func() {
|
||||
cli := fmt.Sprintf("vela svc deploy -t webservice %s -p 80", notEnoughFlagsApplicationName)
|
||||
output, err := e2e.Exec(cli)
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("required flag(s) \"image\" not set"))
|
||||
})
|
||||
})
|
||||
|
||||
e2e.WorkloadDeleteContext("delete", applicationName)
|
||||
})
|
||||
|
||||
@@ -81,16 +81,8 @@ func NewCommand() *cobra.Command {
|
||||
NewDashboardCommand(commandArgs, ioStream, fake.FrontendSource),
|
||||
NewCompletionCommand(),
|
||||
NewVersionCommand(),
|
||||
|
||||
AddCompCommands(commandArgs, ioStream),
|
||||
)
|
||||
|
||||
// Traits
|
||||
if err := AddTraitCommands(cmds, commandArgs, ioStream); err != nil {
|
||||
fmt.Println("Add trait commands from traitDefinition err", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// this is for mute klog
|
||||
fset := flag.NewFlagSet("logs", flag.ContinueOnError)
|
||||
klog.InitFlags(fset)
|
||||
|
||||
23
pkg/commands/common.go
Normal file
23
pkg/commands/common.go
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright 2020 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package commands
|
||||
|
||||
// constants used in `svc` command
|
||||
const (
|
||||
App = "app"
|
||||
Service = "svc"
|
||||
)
|
||||
@@ -1,183 +0,0 @@
|
||||
// nolint:golint
|
||||
// We will soon deprecate this command, we should use 'vela up' as the only deploy command.
|
||||
package commands
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
)
|
||||
|
||||
// constants used in `svc` command
|
||||
const (
|
||||
Staging = "staging"
|
||||
App = "app"
|
||||
WorkloadType = "type"
|
||||
TraitDetach = "detach"
|
||||
Service = "svc"
|
||||
)
|
||||
|
||||
type runOptions serverlib.RunOptions
|
||||
|
||||
func newRunOptions(ioStreams util.IOStreams) *runOptions {
|
||||
return &runOptions{IOStreams: ioStreams}
|
||||
}
|
||||
|
||||
// AddCompCommands creates `svc` command and its nested children command
|
||||
func AddCompCommands(c types.Args, ioStreams util.IOStreams) *cobra.Command {
|
||||
compCommands := &cobra.Command{
|
||||
Use: "svc",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: "Manage services",
|
||||
Long: "Manage services",
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
return c.SetConfig()
|
||||
},
|
||||
}
|
||||
compCommands.PersistentFlags().StringP(App, "a", "", "specify the name of application containing the services")
|
||||
|
||||
compCommands.AddCommand(
|
||||
NewCompDeployCommands(c, ioStreams),
|
||||
)
|
||||
return compCommands
|
||||
}
|
||||
|
||||
// NewCompDeployCommands creates `deploy` command
|
||||
func NewCompDeployCommands(c types.Args, ioStreams util.IOStreams) *cobra.Command {
|
||||
runCmd := &cobra.Command{
|
||||
Use: "deploy [args]",
|
||||
DisableFlagsInUseLine: true,
|
||||
// Dynamic flag parse in compeletion
|
||||
DisableFlagParsing: true,
|
||||
Short: "Initialize and run a service",
|
||||
Long: "Initialize and run a service. The app name would be the same as service name, if it's not specified.",
|
||||
Example: "vela svc deploy -t <SERVICE_TYPE>",
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
return c.SetConfig()
|
||||
},
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if len(args) == 0 || args[0] == "-h" {
|
||||
err := cmd.Help()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
o := newRunOptions(ioStreams)
|
||||
newClient, err := client.New(c.Config, client.Options{Scheme: c.Schema})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o.KubeClient = newClient
|
||||
o.Env, err = GetEnv(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := o.Complete(cmd, args); err != nil {
|
||||
return err
|
||||
}
|
||||
return o.Run(cmd, ioStreams)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
types.TagCommandType: types.TypeApp,
|
||||
},
|
||||
}
|
||||
runCmd.SetOut(ioStreams.Out)
|
||||
|
||||
runCmd.Flags().BoolP(Staging, "s", false, "only save changes locally without real update application")
|
||||
runCmd.Flags().StringP(WorkloadType, "t", "", "specify workload type of the service")
|
||||
|
||||
return runCmd
|
||||
}
|
||||
|
||||
// GetWorkloadNameFromArgs gets workload from the args
|
||||
func GetWorkloadNameFromArgs(args []string) (string, error) {
|
||||
argsLength := len(args)
|
||||
if argsLength < 1 {
|
||||
return "", errors.New("must specify the name of service")
|
||||
}
|
||||
return args[0], nil
|
||||
|
||||
}
|
||||
|
||||
func (o *runOptions) Complete(cmd *cobra.Command, args []string) error {
|
||||
flags := cmd.Flags()
|
||||
flags.AddFlagSet(cmd.PersistentFlags())
|
||||
flags.ParseErrorsWhitelist.UnknownFlags = true
|
||||
|
||||
// First parse, figure out which workloadType it is.
|
||||
if err := flags.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
workloadName, err := GetWorkloadNameFromArgs(flags.Args())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
appName, err := flags.GetString(App)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
workloadType, err := flags.GetString(WorkloadType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if workloadType == "" {
|
||||
workloads, err := plugins.LoadInstalledCapabilityWithType(types.TypeWorkload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var workloadList []string
|
||||
for _, w := range workloads {
|
||||
workloadList = append(workloadList, w.Name)
|
||||
}
|
||||
errMsg := "can not find workload, check workloads by `vela workloads` and choose a suitable one."
|
||||
if workloadList != nil {
|
||||
errMsg = fmt.Sprintf("must specify the workload type of service, please use `-t` and choose from %v.", workloadList)
|
||||
}
|
||||
return errors.New(errMsg)
|
||||
}
|
||||
envName := o.Env.Name
|
||||
|
||||
// Dynamic load flags
|
||||
template, err := plugins.LoadCapabilityByName(workloadType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, v := range template.Parameters {
|
||||
types.SetFlagBy(flags, v)
|
||||
}
|
||||
// Second parse, parse parameters of this workload.
|
||||
if err = flags.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
app, err := serverlib.BaseComplete(envName, workloadName, appName, flags, workloadType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.App = app
|
||||
return err
|
||||
}
|
||||
|
||||
func (o *runOptions) Run(cmd *cobra.Command, io cmdutil.IOStreams) error {
|
||||
staging, err := cmd.Flags().GetBool(Staging)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
msg, err := serverlib.BaseRun(staging, o.App, o.KubeClient, o.Env, io)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o.Info(msg)
|
||||
return nil
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile/api"
|
||||
"github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
|
||||
"github.com/oam-dev/kubevela/pkg/plugins"
|
||||
"github.com/oam-dev/kubevela/pkg/serverlib"
|
||||
)
|
||||
|
||||
type commandOptions struct {
|
||||
Template types.Capability
|
||||
Client client.Client
|
||||
Detach bool
|
||||
Env *types.EnvMeta
|
||||
|
||||
workloadName string
|
||||
appName string
|
||||
app *api.Application
|
||||
traitType string
|
||||
cmdutil.IOStreams
|
||||
}
|
||||
|
||||
// AddTraitCommands loads Trait command from installed capabilities
|
||||
func AddTraitCommands(parentCmd *cobra.Command, c types.Args, ioStreams cmdutil.IOStreams) error {
|
||||
templates, err := plugins.LoadInstalledCapabilityWithType(types.TypeTrait)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ctx := context.Background()
|
||||
for _, tmp := range templates {
|
||||
tmp := tmp
|
||||
|
||||
var name = tmp.Name
|
||||
pluginCmd := &cobra.Command{
|
||||
// We can't hide these command, if so, cli docs will also disappear from auto-gen
|
||||
// Hidden: true,
|
||||
Use: name + " <appname> [args]",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: "Attach " + name + " trait to an app",
|
||||
Long: "Attach " + name + " trait to an app",
|
||||
Example: "vela " + name + " frontend",
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
return c.SetConfig()
|
||||
},
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
o := &commandOptions{IOStreams: ioStreams, traitType: name}
|
||||
o.Template = tmp
|
||||
newClient, err := client.New(c.Config, client.Options{Scheme: c.Schema})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o.Client = newClient
|
||||
o.Env, err = GetEnv(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
detach, _ := cmd.Flags().GetBool(TraitDetach)
|
||||
if detach {
|
||||
if err := o.DetachTrait(cmd, args); err != nil {
|
||||
return err
|
||||
}
|
||||
o.Detach = true
|
||||
} else if err := o.AddOrUpdateTrait(cmd, args); err != nil {
|
||||
return err
|
||||
}
|
||||
return o.Run(ctx, cmd, ioStreams)
|
||||
},
|
||||
}
|
||||
pluginCmd.SetOut(ioStreams.Out)
|
||||
for _, v := range tmp.Parameters {
|
||||
types.SetFlagBy(pluginCmd.Flags(), v)
|
||||
}
|
||||
pluginCmd.Flags().StringP(Service, "", "", "specify one service belonging to the application")
|
||||
pluginCmd.Flags().BoolP(Staging, "s", false, "only save changes locally without real update application")
|
||||
pluginCmd.Flags().BoolP(TraitDetach, "", false, "detach trait from service")
|
||||
|
||||
parentCmd.AddCommand(pluginCmd)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Prepare prepares data for constructing OAM entities
|
||||
func (o *commandOptions) Prepare(cmd *cobra.Command, args []string) error {
|
||||
if len(args) < 1 {
|
||||
return errors.New("please specify the name of the app")
|
||||
}
|
||||
o.appName = args[0]
|
||||
// get application
|
||||
app, err := appfile.LoadApplication(o.Env.Name, o.appName)
|
||||
if err != nil {
|
||||
if appfile.IsNotFound(o.appName, err) {
|
||||
return fmt.Errorf("the application %s doesn't exist in current env %s", o.appName, o.Env.Name)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// get service name
|
||||
serviceNames := appfile.GetComponents(app)
|
||||
if svcName := cmd.Flag(Service).Value.String(); svcName != "" {
|
||||
for _, v := range serviceNames {
|
||||
if v == svcName {
|
||||
o.workloadName = svcName
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("the service %s doesn't exist in the application %s", svcName, o.appName)
|
||||
}
|
||||
svcName, err := util.AskToChooseOneService(serviceNames)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o.workloadName = svcName
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddOrUpdateTrait adds or updates trait
|
||||
func (o *commandOptions) AddOrUpdateTrait(cmd *cobra.Command, args []string) error {
|
||||
var err error
|
||||
if err = o.Prepare(cmd, args); err != nil {
|
||||
return err
|
||||
}
|
||||
flags := cmd.Flags()
|
||||
|
||||
if o.app, err = serverlib.AddOrUpdateTrait(o.Env, o.appName, o.workloadName, flags, o.Template); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DetachTrait removes a trait already attached to a service
|
||||
func (o *commandOptions) DetachTrait(cmd *cobra.Command, args []string) error {
|
||||
var err error
|
||||
if err = o.Prepare(cmd, args); err != nil {
|
||||
return err
|
||||
}
|
||||
if o.app, err = serverlib.PrepareDetachTrait(o.Env.Name, o.traitType, o.workloadName, o.appName); err != nil {
|
||||
return err
|
||||
}
|
||||
var traitType = o.Template.Name
|
||||
if err = appfile.RemoveTrait(o.app, o.workloadName, traitType); err != nil {
|
||||
return err
|
||||
}
|
||||
return appfile.Save(o.app, o.Env.Name)
|
||||
}
|
||||
|
||||
// Run executes create/update/detach trait
|
||||
func (o *commandOptions) Run(ctx context.Context, cmd *cobra.Command, io cmdutil.IOStreams) error {
|
||||
if o.Detach {
|
||||
o.Infof("Detaching %s from app %s\n", o.traitType, o.workloadName)
|
||||
} else {
|
||||
o.Infof("Adding %s for app %s \n", o.Template.Name, o.workloadName)
|
||||
}
|
||||
staging, err := cmd.Flags().GetBool(Staging)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = serverlib.TraitOperationRun(ctx, o.Client, o.Env, o.app, staging, io)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
deployStatus, err := printTrackingDeployStatus(ctx, o.Client, o.IOStreams, o.workloadName, o.appName, o.Env)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if deployStatus != compStatusDeployed {
|
||||
return nil
|
||||
}
|
||||
|
||||
return printComponentStatus(context.Background(), o.Client, o.IOStreams, o.workloadName, o.appName, o.Env)
|
||||
}
|
||||
Reference in New Issue
Block a user