docs: Update default values for Envoy extension proxy types (#17676)

This commit is contained in:
Chris Thain 2023-06-13 07:04:01 -07:00 committed by GitHub
parent a8f1350835
commit ddce431bd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 33 deletions

View File

@ -17,7 +17,7 @@ The following list outlines the field hierarchy, data types, and requirements fo
Click on a property name to view additional details, including default values. Click on a property name to view additional details, including default values.
- [`ProxyType`](#proxytype): string | required - [`ProxyType`](#proxytype): string | `connect-proxy`
- [`Debug`](#debug): bool | `false` - [`Debug`](#debug): bool | `false`
- [`Patches`](#patches): list | required - [`Patches`](#patches): list | required
- [`ResourceFilter`](#patches-resourcefilter): map - [`ResourceFilter`](#patches-resourcefilter): map
@ -69,7 +69,6 @@ Specifies the type of Envoy proxy that the extension applies to. The only suppor
#### Values #### Values
- Default: `connect-proxy` - Default: `connect-proxy`
- This field is required.
- Data type: String - Data type: String
### `Debug` ### `Debug`

View File

@ -15,11 +15,9 @@ Envoy filters support setting and getting dynamic metadata, allowing a filter to
To use the Lua Envoy extension, configure the following arguments in the `EnvoyExtensions` block: To use the Lua Envoy extension, configure the following arguments in the `EnvoyExtensions` block:
| Arguments | Description | - `ProxyType`: string | `connect-proxy` - Determines the proxy type the extension applies to. The only supported value is `connect-proxy`.
| -------------- | ------------------------------------------------------------------------------------------------ | - `ListenerType`: string | required - Specifies if the extension is applied to the `inbound` or `outbound` listener.
| `ProxyType` | Determines the proxy type the extension applies to. The only supported value is `connect-proxy`. | - `Script`: string | required - The Lua script that is configured to run by the HTTP Lua filter.
| `ListenerType` | Specifies if the extension is applied to the `inbound` or `outbound` listener. |
| `Script` | The Lua script that is configured to run by the HTTP Lua filter. |
## Workflow ## Workflow
@ -44,16 +42,15 @@ The following example configures the Lua Envoy extension on every service by usi
<CodeBlockConfig filename="lua-envoy-extension-proxy-defaults.hcl"> <CodeBlockConfig filename="lua-envoy-extension-proxy-defaults.hcl">
```hcl ```hcl
Kind = "proxy-defaults" Kind = "proxy-defaults"
Name = "global" Name = "global"
Protocol = "http" Protocol = "http"
EnvoyExtensions { EnvoyExtensions {
Name = "builtin/lua" Name = "builtin/lua"
Arguments = { Arguments = {
ProxyType = "connect-proxy" ProxyType = "connect-proxy"
Listener = "inbound" Listener = "inbound"
Script = <<-EOS Script = <<-EOS
function envoy_on_request(request_handle) function envoy_on_request(request_handle)
meta = request_handle:streamInfo():dynamicMetadata() meta = request_handle:streamInfo():dynamicMetadata()
m = meta:get("consul") m = meta:get("consul")
@ -159,7 +156,7 @@ $ kubectl apply lua-envoy-extension-proxy-defaults.yaml
In the following example, the `service-defaults` configure the Lua Envoy extension to insert the HTTP Lua filter for service `myservice` and add the Consul service name to the`x-consul-service` header for all inbound requests. The `ListenerType` makes it so that the extension applies only on the inbound listener of the service's connect proxy. In the following example, the `service-defaults` configure the Lua Envoy extension to insert the HTTP Lua filter for service `myservice` and add the Consul service name to the`x-consul-service` header for all inbound requests. The `ListenerType` makes it so that the extension applies only on the inbound listener of the service's connect proxy.
<CodeBlockConfig filename="lua-envoy-extension.json"> <CodeBlockConfig filename="lua-envoy-extension.hcl">
```hcl ```hcl
Kind = "service-defaults" Kind = "service-defaults"
@ -170,8 +167,8 @@ EnvoyExtensions = [
Arguments = { Arguments = {
ProxyType = "connect-proxy" ProxyType = "connect-proxy"
Listener = "inbound" Listener = "inbound"
Script = <<EOF Script = <<EOF
function envoy_on_request(request_handle) function envoy_on_request(request_handle)
local service = request_handle:streamInfo():dynamicMetadata():get("consul")["service"] local service = request_handle:streamInfo():dynamicMetadata():get("consul")["service"]
request_handle:headers():add("x-consul-service", service) request_handle:headers():add("x-consul-service", service)
@ -188,7 +185,7 @@ Alternatively, you can apply the same extension configuration to [`proxy-default
You can also specify multiple Lua filters through the Envoy extensions. They will not override each other. You can also specify multiple Lua filters through the Envoy extensions. They will not override each other.
<CodeBlockConfig filename="lua-envoy-extension.json"> <CodeBlockConfig filename="lua-envoy-extension.hcl">
```hcl ```hcl
Kind = "service-defaults" Kind = "service-defaults"
@ -198,8 +195,8 @@ EnvoyExtensions = [
Name = "builtin/lua", Name = "builtin/lua",
Arguments = { Arguments = {
ProxyType = "connect-proxy" ProxyType = "connect-proxy"
Listener = "inbound" Listener = "inbound"
Script = <<-EOF Script = <<-EOF
function envoy_on_request(request_handle) function envoy_on_request(request_handle)
meta = request_handle:streamInfo():dynamicMetadata() meta = request_handle:streamInfo():dynamicMetadata()
m = meta:get("consul") m = meta:get("consul")
@ -212,8 +209,8 @@ end
Name = "builtin/lua", Name = "builtin/lua",
Arguments = { Arguments = {
ProxyType = "connect-proxy" ProxyType = "connect-proxy"
Listener = "inbound" Listener = "inbound"
Script = <<-EOF Script = <<-EOF
function envoy_on_request(request_handle) function envoy_on_request(request_handle)
meta = request_handle:streamInfo():dynamicMetadata() meta = request_handle:streamInfo():dynamicMetadata()
m = meta:get("consul") m = meta:get("consul")

View File

@ -32,28 +32,30 @@ In the following service defaults configuration entry example, Consul adds a new
<CodeBlockConfig filename="property-override-extension-service-defaults.hcl"> <CodeBlockConfig filename="property-override-extension-service-defaults.hcl">
```hcl ```hcl
Kind = "service-defaults" Kind = "service-defaults"
Name = "global" Name = "global"
Protocol = "http" Protocol = "http"
EnvoyExtensions = [ EnvoyExtensions = [
{ {
Name = "builtin/property-override" Name = "builtin/property-override"
Arguments = { Arguments = {
ProxyType = "connect-proxy", ProxyType = "connect-proxy"
Patches = [ Patches = [
{ {
ResourceFilter = { ResourceFilter = {
ResourceType = "cluster", ResourceType = "cluster"
TrafficDirection = "outbound" TrafficDirection = "outbound"
Services = [{ Services = [{
Name = "other-svc" Name = "other-svc"
}], }]
Op = "add" }
Path = "/upstream_connection_options/tcp_keepalive/keepalive_probes", Op = "add"
Value = 5, Path = "/upstream_connection_options/tcp_keepalive/keepalive_probes"
Value = 5
} }
] ]
} }
}
] ]
``` ```
</CodeBlockConfig> </CodeBlockConfig>