tunning docs

This commit is contained in:
天元
2020-11-16 14:07:38 +08:00
parent 47222606dd
commit efb76ee5ee
73 changed files with 133 additions and 130 deletions
@@ -17,11 +17,11 @@ spec:
apiVersion: "core.oam.dev/v1alpha2"
kind: "ManualScalerTrait"
spec: {
replicaCount: parameter.replica
replicaCount: parameter.replicas
}
}
parameter: {
//+short=r
replica: *1 | int
replicas: *1 | int
}
@@ -1,7 +1,7 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: metric
name: metrics
annotations:
definition.oam.dev/description: "Configure metrics targets to be monitored for the app"
spec:
@@ -25,7 +25,7 @@ spec:
// +usage=format of the metrics, default as prometheus
// +short=f
format: *"prometheus" | string
// +usage= the metric path of the service
// +usage= the metrics path of the service
path: *"/metrics" | string
scheme: *"http" | string
enabled: *true | bool
@@ -36,16 +36,16 @@ spec:
// percentage (0-100)
stepWeight: parameter.stepWeight
// max replicas scale up to canary
maxReplicas: parameter.replica
maxReplicas: parameter.replicas
}
}
}
parameter: {
// +usage=total replica of the workload
replica: *5 | int
// +usage=total replicas of the workload
replicas: *2 | int
// +alias=step-weight
// +usage=weight percent of every step in rolling update
stepWeight: *20 | int
stepWeight: *50 | int
interval: *"30s" | string
}
+6 -6
View File
@@ -426,7 +426,7 @@ Please also specify `traits` values if need to attach a trait to several traits
"workload_name": "poc5",
"flags": [
{
"name": "replica",
"name": "replicas",
"value": "4"
}
]
@@ -534,7 +534,7 @@ sample request
"name": "scale",
"flags": [
{
"name": "replica",
"name": "replicas",
"value": "4"
}
]
@@ -556,9 +556,9 @@ sample response
"data": {
"name": "manualscaler",
"type": "trait",
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"ManualScalerTrait\"\n\tspec: {\n\t\treplicaCount: manualscaler.replica\n\t}\n}\nmanualscaler: {\n\t//+short=r\n\treplica: *2 | int\n}\n",
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"ManualScalerTrait\"\n\tspec: {\n\t\treplicaCount: manualscaler.replicas\n\t}\n}\nmanualscaler: {\n\t//+short=r\n\treplicas: *2 | int\n}\n",
"parameters": [{
"name": "replica",
"name": "replicas",
"short": "r",
"default": 2,
"type": 4
@@ -702,9 +702,9 @@ sample response
},{
"name": "rollout",
"type": "trait",
"template": "#Template: {\n\tapiVersion: \"extend.oam.dev/v1alpha2\"\n\tkind: \"SimpleRolloutTrait\"\n\tspec: {\n\t\treplica: rollout.replica\n\t\tmaxUnavailable: rollout.maxUnavailable\n\t\tbatch: rollout.batch\n\t}\n}\nrollout: {\n\treplica: *3 | int\n\tmaxUnavailable: *1 | int\n\tbatch: *2 | int\n}\n",
"template": "#Template: {\n\tapiVersion: \"extend.oam.dev/v1alpha2\"\n\tkind: \"SimpleRolloutTrait\"\n\tspec: {\n\t\treplicas: rollout.replicas\n\t\tmaxUnavailable: rollout.maxUnavailable\n\t\tbatch: rollout.batch\n\t}\n}\nrollout: {\n\treplicas: *3 | int\n\tmaxUnavailable: *1 | int\n\tbatch: *2 | int\n}\n",
"parameters": [{
"name": "replica",
"name": "replicas",
"default": 3,
"type": 4
}, {
+2 -2
View File
@@ -50,14 +50,14 @@ services:
- /mnt/path=sec:my-secret
scale:
replica: 2
replicas: 2
auto: # automatic scale up and down based on given metrics
range: "1-10"
cpu: 80 # if cpu utilization is above 80%, scale up
qps: 1000 # if qps is higher than 1k, scale up
canary: # Auto-create canary deployment. Only upgrade after verify successfully.
replica: 1 # canary deployment size
replicas: 1 # canary deployment size
headers:
- "foo:bar.*"
```
+1 -1
View File
@@ -66,7 +66,7 @@
- [vela route](/en/cli/vela_route.md)
- [vela autoscale](/en/cli/vela_autoscale.md)
- [vela rollout](/en/cli/vela_rollout.md)
- [vela metric](/en/cli/vela_metric.md)
- [vela metrics](/en/cli/vela_metric.md)
- System
- [vela completion](/en/cli/vela_completion.md)
- [vela dashboard](/en/cli/vela_dashboard.md)
+6 -1
View File
@@ -19,6 +19,7 @@ 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
@@ -30,7 +31,11 @@ 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 status](vela_status.md) - Show status of an application
* [vela svc](vela_svc.md) - Manage services
@@ -41,4 +46,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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+8 -8
View File
@@ -19,13 +19,13 @@ vela autoscale frontend
### Options
```
--cpuPercent 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
--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
@@ -38,4 +38,4 @@ vela autoscale frontend
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 12-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -32,4 +32,4 @@ vela cap center ls
* [vela cap center](vela_cap_center.md) - Manage Capability Center
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -32,4 +32,4 @@ vela config del <config-name>
* [vela config](vela_config.md) - Manage configurations
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -32,4 +32,4 @@ vela config get <config-name>
* [vela config](vela_config.md) - Manage configurations
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -32,4 +32,4 @@ vela config ls
* [vela config](vela_config.md) - Manage configurations
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -38,4 +38,4 @@ dashboard
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -33,4 +33,4 @@ vela delete frontend
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -32,4 +32,4 @@ vela env delete test
* [vela env](vela_env.md) - Manage environments
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -32,4 +32,4 @@ vela env ls [env-name]
* [vela env](vela_env.md) - Manage environments
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -32,4 +32,4 @@ vela env set test
* [vela env](vela_env.md) - Manage environments
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -29,4 +29,4 @@ vela exec [flags] APP_NAME -- COMMAND [args...]
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -33,4 +33,4 @@ vela init
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -31,4 +31,4 @@ vela install [flags]
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -27,4 +27,4 @@ vela logs [flags]
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -33,4 +33,4 @@ vela ls
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
@@ -1,19 +1,19 @@
## vela metric
## vela metrics
Attach metric trait to an app
Attach metrics trait to an app
### Synopsis
Attach metric trait to an app
Attach metrics trait to an app
```
vela metric <appname> [args]
vela metrics <appname> [args]
```
### Examples
```
vela metric frontend
vela metrics frontend
```
### Options
@@ -22,8 +22,8 @@ vela metric frontend
--detach detach trait from service
--enabled (default true)
-f, --format string format of the metrics, default as prometheus (default "prometheus")
-h, --help help for metric
--path string the metric path of the service (default "/metrics")
-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 string (default "http")
-s, --staging only save changes locally without real update application
@@ -40,4 +40,4 @@ vela metric frontend
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 12-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -29,4 +29,4 @@ vela port-forward APP_NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+3 -3
View File
@@ -22,9 +22,9 @@ vela rollout frontend
--detach detach trait from service
-h, --help help for rollout
--interval string (default "30s")
--replica int total replica of the workload (default 5)
--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 20)
--step-weight int weight percent of every step in rolling update (default 50)
--svc string specify one service belonging to the application
```
@@ -38,4 +38,4 @@ vela rollout frontend
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 12-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -37,4 +37,4 @@ vela route frontend
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 12-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+6 -6
View File
@@ -19,11 +19,11 @@ vela scaler frontend
### Options
```
--detach detach trait from service
-h, --help help for scaler
-r, --replica int (default 1)
-s, --staging only save changes locally without real update application
--svc string specify one service belonging to the application
--detach detach trait from service
-h, --help help for scaler
-r, --replicas int (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
@@ -36,4 +36,4 @@ vela scaler frontend
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 12-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -33,4 +33,4 @@ vela show APP_NAME
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -33,4 +33,4 @@ vela status APP_NAME
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -24,4 +24,4 @@ Manage services
* [vela](vela.md) -
* [vela svc deploy](vela_svc_deploy.md) - Initialize and run a service
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -35,4 +35,4 @@ vela svc deploy -t <SERVICE_TYPE>
* [vela svc](vela_svc.md) - Manage services
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -23,4 +23,4 @@ System management utilities
* [vela](vela.md) -
* [vela system info](vela_system_info.md) - Show vela client and cluster chartPath
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -26,4 +26,4 @@ vela system info [flags]
* [vela system](vela_system.md) - System management utilities
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -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 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -32,4 +32,4 @@ vela template context
* [vela template](vela_template.md) - Manage templates
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -34,4 +34,4 @@ vela traits
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -27,4 +27,4 @@ vela up
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -26,4 +26,4 @@ vela version [flags]
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+1 -1
View File
@@ -33,4 +33,4 @@ vela workloads
* [vela](vela.md) -
###### Auto generated by spf13/cobra on 13-Nov-2020
###### Auto generated by spf13/cobra on 16-Nov-2020
+7 -7
View File
@@ -179,12 +179,12 @@ please refer to [autoscale in Appfile](/en/developers/set-autoscale.md).
With more and more requests to the application, the replicas gradually increase from one to four.
## `vela metric`
## `vela metrics`
A shortcut to add metrics config.
If your application has exposed metrics, you can easily setup monitoring system
with the help of `metric` capability.
with the help of `metrics` capability.
Let's run [`christianhxc/gorandom:1.0`](https://github.com/christianhxc/prometheus-tutorial) as an example app.
The app will emit random latencies as metrics.
@@ -193,18 +193,18 @@ The app will emit random latencies as metrics.
$ vela svc deploy metricapp -t webservice --image christianhxc/gorandom:1.0 --port 8080
```
Then add metric by:
Then add metrics by:
```bash
$ vela metric metricapp
Adding metric for app metricapp
$ vela metrics metricapp
Adding metrics for app metricapp
⠋ Deploying ...
✅ Application Deployed Successfully!
- Name: metricapp
Type: webservice
HEALTHY Ready: 1/1
Routes:
- ✅ metric: Monitoring port: 8080, path: /metrics, format: prometheus, schema: http.
- ✅ metrics: Monitoring port: 8080, path: /metrics, format: prometheus, schema: http.
Last Deployment:
Created at: 2020-11-02 14:31:56 +0800 CST
Updated at: 2020-11-02T14:32:00+08:00
@@ -261,7 +261,7 @@ Hello World%
Secondly, add rollout policy for your app:
```shell script
$ vela rollout testapp --replica 5 --step-weight 20 --interval 5s
$ vela rollout testapp --replicas 5 --step-weight 20 --interval 5s
```
Then update your app by:
@@ -26,7 +26,7 @@ services:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Path** | **string** | the metric path of the service | [default to /metrics]
**Path** | **string** | the metrics path of the service | [default to /metrics]
**Format** | **string** | +format of the metrics, default as prometheus | [default to prometheus]
**Scheme** | **string** | | [default to http]
**Enabled** | **bool** | | [default to true]
@@ -8,7 +8,7 @@
### `Autoscale`
When `Rollout` and `Autoscle` traits are attached to the same service, they two will fight over the number of instances during rollout. Thus, it's by design that `Rollout` will take over replicas control (specified by `.replica` field) during rollout.
When `Rollout` and `Autoscle` traits are attached to the same service, they two will fight over the number of instances during rollout. Thus, it's by design that `Rollout` will take over replicas control (specified by `.replicas` field) during rollout.
> Note: in up coming releases, KubeVela will introduce a separate section in Appfile to define release phase configurations such as `Rollout`.
@@ -22,8 +22,8 @@ servcies:
...
rollout:
replica: 2
stepWeight: 5
replicas: 2
stepWeight: 50
interval: "10s"
```
@@ -31,8 +31,8 @@ servcies:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**replica** | **string** | replica number of the service instance per revision | [ default to 5 ]
**stepWeight** | **string** | canary increment step percentage (0-100)| [default to 20 ]
**replicas** | **string** | replicas number of the service instance per revision | [ default to 2 ]
**stepWeight** | **string** | canary increment step percentage (0-100)| [default to 50 ]
**interval** | **string** | wait interval for every rolling update step | [default to '30s']
## How `Rollout` works?
@@ -44,7 +44,7 @@ In detail, `Rollout` controller will create a canary of your app , and then grad
![alt](../../../../resources/traffic-shifting-analysis.png)
In this sample, for every `10s`, `5%` traffic will be shifted to canary from the primary, until the traffic on canary reached `50%`. At the mean time, the instance number of canary will automatically scale to `replica: 2` per configured in Appfile.
In this sample, for every `10s`, `5%` traffic will be shifted to canary from the primary, until the traffic on canary reached `50%`. At the mean time, the instance number of canary will automatically scale to `replicas: 2` per configured in Appfile.
Based on analysis result of the KPIs during this traffic shifting, a canary will be promoted or aborted if analysis is failed. If promoting, the primary will be upgraded from v1 to v2, and traffic will be fully shifted back to the primary instances. So as result, canary instances will be deleted after the promotion finished.
@@ -15,7 +15,7 @@ services:
my-service-name:
...
scaler:
replica: 100
replicas: 100
```
## Properties
+3 -3
View File
@@ -1,6 +1,6 @@
# Monitoring Application
If your application has exposed metrics, you can easily tell the platform how to collect the metrics data from your app with `metric` capability.
If your application has exposed metrics, you can easily tell the platform how to collect the metrics data from your app with `metrics` capability.
Let's run [`christianhxc/gorandom:1.0`](https://github.com/christianhxc/prometheus-tutorial) as an example app.
The app will emit random latencies as metrics.
@@ -17,7 +17,7 @@ The app will emit random latencies as metrics.
image: christianhxc/gorandom:1.0
port: 8080
metric:
metrics:
enabled: true
format: prometheus
path: /metrics
@@ -49,7 +49,7 @@ The app will emit random latencies as metrics.
Type: webservice
HEALTHY Ready: 1/1
Traits:
- ✅ metric: Monitoring port: 8080, path: /metrics, format: prometheus, schema: http.
- ✅ metrics: Monitoring port: 8080, path: /metrics, format: prometheus, schema: http.
Last Deployment:
Created at: 2020-11-11 17:00:59 -0800 PST
Updated at: 2020-11-11T17:01:06-08:00
+4 -4
View File
@@ -13,7 +13,7 @@ services:
port: 80
rollout:
replica: 5
replicas: 5
stepWeight: 20
interval: "30s"
@@ -47,7 +47,7 @@ Services:
HEALTHY Ready: 5/5
Traits:
- ✅ rollout: interval=5s
replica=5
replicas=5
stepWeight=20
- ✅ route: Visiting URL: http://example.com IP: <your-ingress-IP-address>
@@ -76,7 +76,7 @@ services:
+ image: oamdev/testapp:rolling02
port: 80
rollout:
replica: 5
replicas: 5
stepWeight: 20
interval: "30s"
route:
@@ -107,7 +107,7 @@ Services:
HEALTHY express-server-v2:Ready: 1/1 express-server-v1:Ready: 4/4
Traits:
- ✅ rollout: interval=30s
replica=5
replicas=5
stepWeight=20
- ✅ route: Visiting by using 'vela port-forward testapp --route'
+1 -1
View File
@@ -21,7 +21,7 @@ services:
port: 8080
# scaler:
# replica: 1
# replicas: 1
# route:
# domain: example.com
+1 -1
View File
@@ -142,7 +142,7 @@ var (
ginkgo.It("should sync capabilities from cluster before listing trait capabilities", func() {
output, err := Exec("vela traits")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(output).To(gomega.ContainSubstring("metric"))
gomega.Expect(output).To(gomega.ContainSubstring("metrics"))
gomega.Expect(output).To(gomega.ContainSubstring("rollout"))
gomega.Expect(output).To(gomega.ContainSubstring("route"))
})
+2 -2
View File
@@ -2,10 +2,10 @@ output: {
apiVersion: "core.oam.dev/v1alpha2"
kind: "ManualScalerTrait"
spec: {
replicaCount: parameter.replica
replicaCount: parameter.replicas
}
}
parameter: {
//+short=r
replica: *1 | int
replicas: *1 | int
}
+1 -1
View File
@@ -9,7 +9,7 @@ parameter: {
// +usage=format of the metrics, default as prometheus
// +short=f
format: *"prometheus" | string
// +usage= the metric path of the service
// +usage= the metrics path of the service
path: *"/metrics" | string
scheme: *"http" | string
enabled: *true | bool
+4 -4
View File
@@ -21,15 +21,15 @@ output: {
// percentage (0-100)
stepWeight: parameter.stepWeight
// max replicas scale up to canary
maxReplicas: parameter.replica
maxReplicas: parameter.replicas
}
}
}
parameter: {
// +usage=total replica of the workload
replica: *5 | int
// +usage=total replicas of the workload
replicas: *2 | int
// +alias=step-weight
// +usage=weight percent of every step in rolling update
stepWeight: *20 | int
stepWeight: *50 | int
interval: *"30s" | string
}
+1 -1
View File
@@ -1,7 +1,7 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: metric
name: metrics
annotations:
definition.oam.dev/description: "Configure metrics targets to be monitored for the app"
spec:
+3 -2
View File
@@ -78,13 +78,13 @@ func printRefreshReport(newCaps, oldCaps []types.Capability, io cmdutil.IOStream
}
}
if !silent {
io.Infof("Automatically discover capabilities successfully %s(no changes)\n", emojiSucceed)
io.Infof("Automatically discover capabilities successfully %s(no changes)\n\n", emojiSucceed)
io.Info(table.String())
}
return
}
io.Infof("Automatically discover capabilities successfully %sAdd(%s) Update(%s) Delete(%s)\n",
io.Infof("Automatically discover capabilities successfully %sAdd(%s) Update(%s) Delete(%s)\n\n",
emojiSucceed,
green.Sprint(len(report[added])),
yellow.Sprint(len(report[updated])),
@@ -94,6 +94,7 @@ func printRefreshReport(newCaps, oldCaps []types.Capability, io cmdutil.IOStream
addStsRow(updated, report, table)
addStsRow(deleted, report, table)
io.Info(table.String())
io.Info()
}
func addStsRow(sts refreshStatus, report map[refreshStatus][]types.Capability, t *uitable.Table) {
+2 -1
View File
@@ -40,7 +40,8 @@ func AddTraitCommands(parentCmd *cobra.Command, c types.Args, ioStreams cmdutil.
var name = tmp.Name
pluginCmd := &cobra.Command{
Hidden: true,
// 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",
-1
View File
@@ -44,7 +44,6 @@ func NewTraitsCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Command
func printTraitList(workloadName *string, ioStreams cmdutil.IOStreams) error {
table := uitable.New()
table.Wrap = true
table.MaxColWidth = 60
traitDefinitionList, err := oam.ListTraitDefinitions(workloadName)
if err != nil {
return err
-1
View File
@@ -43,7 +43,6 @@ func NewWorkloadsCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Comma
func printWorkloadList(workloadList []types.Capability, ioStreams cmdutil.IOStreams) error {
table := uitable.New()
table.MaxColWidth = 60
table.AddRow("NAME", "DESCRIPTION")
for _, r := range workloadList {
table.AddRow(r.Name, r.Description)
+2 -2
View File
@@ -2,10 +2,10 @@ output: {
apiVersion: "core.oam.dev/v1alpha2"
kind: "ManualScalerTrait"
spec: {
replicaCount: parameter.replica
replicaCount: parameter.replicas
}
}
parameter: {
//+short=r
replica: *2 | int
replicas: *2 | int
}
+1 -3
View File
@@ -29,12 +29,10 @@ func GetChecker(traitType string, c client.Client) Checker {
switch traitType {
case "route":
return &RouteChecker{c: c}
case "metric":
case "metrics":
return &MetricChecker{c: c}
case "autoscale":
return &AutoscalerChecker{c: c}
case "cronscale":
return &AutoscalerChecker{c: c}
}
return &DefaultChecker{c: c}
+2 -2
View File
@@ -16,10 +16,10 @@ spec:
apiVersion: "core.oam.dev/v1alpha2"
kind: "ManualScalerTrait"
spec: {
replicaCount: parameter.replica
replicaCount: parameter.replicas
}
}
parameter: {
//+short=r
replica: *2 | int
replicas: *2 | int
}