Document how to json encode envoy config

It wasn't clear how users should encode their config.
This commit is contained in:
Luke Kysow 2019-11-29 09:43:42 -08:00
parent db8c19289a
commit a0b1cd30a1
No known key found for this signature in database
GPG Key ID: FA168D4DC3F04307
1 changed files with 50 additions and 0 deletions

View File

@ -317,6 +317,56 @@ field set to the appropriate type (for example
`type.googleapis.com/envoy.api.v2.Listener`), or it may be the direct encoding `type.googleapis.com/envoy.api.v2.Listener`), or it may be the direct encoding
with no `@type` field. with no `@type` field.
For example, given a tracing config:
```json
"tracing": {
"http": {
"name": "envoy.zipkin",
"config": {
"collector_cluster": "zipkin",
"collector_endpoint": "/api/v1/spans",
"shared_span_context": false
}
}
}
```
JSON escape the value of `tracing` into a string, for example using [https://codebeautify.org/json-escape-unescape](https://codebeautify.org/json-escape-unescape),
and then use that as the value for `envoy_tracing_json`:
```json
{
"kind": "proxy-defaults",
"name": "global",
"config": {
"envoy_tracing_json": "{\"http\":{\"name\":\"envoy.zipkin\",\"config\":{\"collector_cluster\":\"zipkin\",\"collector_endpoint\":\"/api/v1/spans\",\"shared_span_context\":false}}}"
}
}
```
If using HCL, this escaping is done automatically:
```hcl
Kind = "proxy-defaults"
Name = "global"
Config {
envoy_tracing_json = <<EOF
{
"http": {
"name": "envoy.zipkin",
"config": {
"collector_cluster": "zipkin",
"collector_endpoint": "/api/v1/spans",
"shared_span_context": false
}
}
}
EOF
}
```
### Advanced Bootstrap Options ### Advanced Bootstrap Options
Users may add the following configuration items to the [global `proxy-defaults` Users may add the following configuration items to the [global `proxy-defaults`