Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.

- [`ProxyType`](#proxytype): string | required
- [`ProxyType`](#proxytype): string | `connect-proxy`
- [`Debug`](#debug): bool | `false`
- [`Patches`](#patches): list | required
- [`ResourceFilter`](#patches-resourcefilter): map
Expand Down Expand Up @@ -69,7 +69,6 @@ Specifies the type of Envoy proxy that the extension applies to. The only suppor
#### Values

- Default: `connect-proxy`
- This field is required.
- Data type: String

### `Debug`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:

| Arguments | Description |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the header from this table still?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it from a table to a list so that it is more consistent with the configuration docs for the other extensions. Because there are only 3 config fields, I didn't think that it was worth creating a new config section for the Lua filter. Do you think this is OK?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong opinion here; that seems reasonable - I mostly asked from a diff-catching perspective. Happy to go w/ that or Docs' preference if they have one 👍🏻

| -------------- | ------------------------------------------------------------------------------------------------ |
| `ProxyType` | Determines the proxy type the extension applies to. The only supported value is `connect-proxy`. |
| `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. |
- `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.
- `Script`: string | required - The Lua script that is configured to run by the HTTP Lua filter.

## Workflow

Expand All @@ -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">

```hcl
Kind = "proxy-defaults"
Name = "global"
Protocol = "http"
Kind = "proxy-defaults"
Name = "global"
Protocol = "http"
EnvoyExtensions {
Name = "builtin/lua"

Arguments = {
ProxyType = "connect-proxy"
Listener = "inbound"
Script = <<-EOS
Listener = "inbound"
Script = <<-EOS
function envoy_on_request(request_handle)
meta = request_handle:streamInfo():dynamicMetadata()
m = meta:get("consul")
Expand Down Expand Up @@ -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.

<CodeBlockConfig filename="lua-envoy-extension.json">
<CodeBlockConfig filename="lua-envoy-extension.hcl">

```hcl
Kind = "service-defaults"
Expand All @@ -170,8 +167,8 @@ EnvoyExtensions = [

Arguments = {
ProxyType = "connect-proxy"
Listener = "inbound"
Script = <<EOF
Listener = "inbound"
Script = <<EOF
function envoy_on_request(request_handle)
local service = request_handle:streamInfo():dynamicMetadata():get("consul")["service"]
request_handle:headers():add("x-consul-service", service)
Expand All @@ -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.

<CodeBlockConfig filename="lua-envoy-extension.json">
<CodeBlockConfig filename="lua-envoy-extension.hcl">

```hcl
Kind = "service-defaults"
Expand All @@ -198,8 +195,8 @@ EnvoyExtensions = [
Name = "builtin/lua",
Arguments = {
ProxyType = "connect-proxy"
Listener = "inbound"
Script = <<-EOF
Listener = "inbound"
Script = <<-EOF
function envoy_on_request(request_handle)
meta = request_handle:streamInfo():dynamicMetadata()
m = meta:get("consul")
Expand All @@ -212,8 +209,8 @@ end
Name = "builtin/lua",
Arguments = {
ProxyType = "connect-proxy"
Listener = "inbound"
Script = <<-EOF
Listener = "inbound"
Script = <<-EOF
function envoy_on_request(request_handle)
meta = request_handle:streamInfo():dynamicMetadata()
m = meta:get("consul")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,30 @@ In the following service defaults configuration entry example, Consul adds a new
<CodeBlockConfig filename="property-override-extension-service-defaults.hcl">

```hcl
Kind = "service-defaults"
Name = "global"
Protocol = "http"
Kind = "service-defaults"
Name = "global"
Protocol = "http"
EnvoyExtensions = [
{
Name = "builtin/property-override"
Arguments = {
ProxyType = "connect-proxy",
ProxyType = "connect-proxy"
Patches = [
{
ResourceFilter = {
ResourceType = "cluster",
TrafficDirection = "outbound"
ResourceType = "cluster"
TrafficDirection = "outbound"
Services = [{
Name = "other-svc"
}],
Op = "add"
Path = "/upstream_connection_options/tcp_keepalive/keepalive_probes",
Value = 5,
}]
}
Op = "add"
Path = "/upstream_connection_options/tcp_keepalive/keepalive_probes"
Value = 5
}
]
}
]
}
}
]
```
</CodeBlockConfig>
Expand Down