Envoy Filter

EnvoyFilter provides a mechanism to customize the Envoy configuration generated by Istio Pilot. Use EnvoyFilter to modify values for certain fields, add specific filters, or even add entirely new listeners, clusters, etc. This feature must be used with care, as incorrect configurations could potentially destabilize the entire mesh. Unlike other Istio networking objects, EnvoyFilters are additively applied. Any number of EnvoyFilters can exist for a given workload in a specific namespace. The order of application of these EnvoyFilters is as follows: all EnvoyFilters in the config root namespace, followed by all matching EnvoyFilters in the workload’s namespace.

NOTE 1: Some aspects of this API are deeply tied to the internal implementation in Istio networking subsystem as well as Envoy’s XDS API. While the EnvoyFilter API by itself will maintain backward compatibility, any envoy configuration provided through this mechanism should be carefully monitored across Istio proxy version upgrades, to ensure that deprecated fields are removed and replaced appropriately.

NOTE 2: When multiple EnvoyFilters are bound to the same workload in a given namespace, all patches will be processed sequentially in order of creation time. The behavior is undefined if multiple EnvoyFilter configurations conflict with each other.

NOTE 3: To apply an EnvoyFilter resource to all workloads (sidecars and gateways) in the system, define the resource in the config root namespace, without a workloadSelector.

The example below declares a global default EnvoyFilter resource in the root namespace called istio-config, that adds a custom protocol filter on all sidecars in the system, for outbound port 9307. The filter should be added before the terminating tcp_proxy filter to take effect. In addition, it sets a 30s idle timeout for all HTTP connections in both gateways and sidecars.

  1. apiVersion: networking.istio.io/v1alpha3
  2. kind: EnvoyFilter
  3. metadata:
  4. name: custom-protocol
  5. namespace: istio-config # as defined in meshConfig resource.
  6. spec:
  7. configPatches:
  8. - applyTo: NETWORK_FILTER
  9. match:
  10. context: SIDECAR_OUTBOUND # will match outbound listeners in all sidecars
  11. listener:
  12. portNumber: 9307
  13. filterChain:
  14. filter:
  15. name: "envoy.filters.network.tcp_proxy"
  16. patch:
  17. operation: INSERT_BEFORE
  18. value:
  19. # This is the full filter config including the name and typed_config section.
  20. name: "envoy.extensions.filters.network.mongo_proxy"
  21. typed_config:
  22. "@type": "type.googleapis.com/envoy.extensions.filters.network.mongo_proxy.v3.MongoProxy"
  23. ...
  24. - applyTo: NETWORK_FILTER # http connection manager is a filter in Envoy
  25. match:
  26. # context omitted so that this applies to both sidecars and gateways
  27. listener:
  28. filterChain:
  29. filter:
  30. name: "envoy.filters.network.http_connection_manager"
  31. patch:
  32. operation: MERGE
  33. value:
  34. name: "envoy.filters.network.http_connection_manager"
  35. typed_config:
  36. "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"
  37. common_http_protocol_options:
  38. idle_timeout: 30s

The following example enables Envoy’s Lua filter for all inbound HTTP calls arriving at service port 8080 of the reviews service pod with labels “app: reviews”, in the bookinfo namespace. The lua filter calls out to an external service internal.org.net:8888 that requires a special cluster definition in envoy. The cluster is also added to the sidecar as part of this configuration.

  1. apiVersion: networking.istio.io/v1alpha3
  2. kind: EnvoyFilter
  3. metadata:
  4. name: reviews-lua
  5. namespace: bookinfo
  6. spec:
  7. workloadSelector:
  8. labels:
  9. app: reviews
  10. configPatches:
  11. # The first patch adds the lua filter to the listener/http connection manager
  12. - applyTo: HTTP_FILTER
  13. match:
  14. context: SIDECAR_INBOUND
  15. listener:
  16. portNumber: 8080
  17. filterChain:
  18. filter:
  19. name: "envoy.filters.network.http_connection_manager"
  20. subFilter:
  21. name: "envoy.filters.http.router"
  22. patch:
  23. operation: INSERT_BEFORE
  24. value: # lua filter specification
  25. name: envoy.filters.http.lua
  26. typed_config:
  27. "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua"
  28. defaultSourceCode:
  29. inlineString: |
  30. function envoy_on_request(request_handle)
  31. -- Make an HTTP call to an upstream host with the following headers, body, and timeout.
  32. local headers, body = request_handle:httpCall(
  33. "lua_cluster",
  34. {
  35. [":method"] = "POST",
  36. [":path"] = "/acl",
  37. [":authority"] = "internal.org.net"
  38. },
  39. "authorize call",
  40. 5000)
  41. end
  42. # The second patch adds the cluster that is referenced by the lua code
  43. # cds match is omitted as a new cluster is being added
  44. - applyTo: CLUSTER
  45. match:
  46. context: SIDECAR_OUTBOUND
  47. patch:
  48. operation: ADD
  49. value: # cluster specification
  50. name: "lua_cluster"
  51. type: STRICT_DNS
  52. connect_timeout: 0.5s
  53. lb_policy: ROUND_ROBIN
  54. load_assignment:
  55. cluster_name: lua_cluster
  56. endpoints:
  57. - lb_endpoints:
  58. - endpoint:
  59. address:
  60. socket_address:
  61. protocol: TCP
  62. address: "internal.org.net"
  63. port_value: 8888

The following example overwrites certain fields (HTTP idle timeout and X-Forward-For trusted hops) in the HTTP connection manager in a listener on the ingress gateway in istio-system namespace for the SNI host app.example.com:

  1. apiVersion: networking.istio.io/v1alpha3
  2. kind: EnvoyFilter
  3. metadata:
  4. name: hcm-tweaks
  5. namespace: istio-system
  6. spec:
  7. workloadSelector:
  8. labels:
  9. istio: ingressgateway
  10. configPatches:
  11. - applyTo: NETWORK_FILTER # http connection manager is a filter in Envoy
  12. match:
  13. context: GATEWAY
  14. listener:
  15. filterChain:
  16. sni: app.example.com
  17. filter:
  18. name: "envoy.filters.network.http_connection_manager"
  19. patch:
  20. operation: MERGE
  21. value:
  22. typed_config:
  23. "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"
  24. xff_num_trusted_hops: 5
  25. common_http_protocol_options:
  26. idle_timeout: 30s

The following example inserts an attributegen filter that produces istio_operationId attribute which is consumed by the istio.stats filter. filterClass: STATS encodes this dependency.

  1. apiVersion: networking.istio.io/v1alpha3
  2. kind: EnvoyFilter
  3. metadata:
  4. name: reviews-request-operation
  5. namespace: myns
  6. spec:
  7. workloadSelector:
  8. labels:
  9. app: reviews
  10. configPatches:
  11. - applyTo: HTTP_FILTER
  12. match:
  13. context: SIDECAR_INBOUND
  14. patch:
  15. operation: ADD
  16. filterClass: STATS # This filter will run *before* the Istio stats filter.
  17. value:
  18. name: istio.request_operation
  19. typed_config:
  20. "@type": type.googleapis.com/udpa.type.v1.TypedStruct
  21. type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
  22. value:
  23. config:
  24. configuration: |
  25. {
  26. "attributes": [
  27. {
  28. "output_attribute": "istio_operationId",
  29. "match": [
  30. {
  31. "value": "ListReviews",
  32. "condition": "request.url_path == '/reviews' && request.method == 'GET'"
  33. }]
  34. }]
  35. }
  36. vm_config:
  37. runtime: envoy.wasm.runtime.null
  38. code:
  39. local: { inline_string: "envoy.wasm.attributegen" }

The following example inserts an http ext_authz filter in the myns namespace.

  1. apiVersion: networking.istio.io/v1alpha3
  2. kind: EnvoyFilter
  3. metadata:
  4. name: myns-ext-authz
  5. namespace: myns
  6. spec:
  7. configPatches:
  8. - applyTo: HTTP_FILTER
  9. match:
  10. context: SIDECAR_INBOUND
  11. patch:
  12. operation: ADD
  13. filterClass: AUTHZ # This filter will run *after* the Istio authz filter.
  14. value:
  15. name: envoy.filters.http.ext_authz
  16. typed_config:
  17. "@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
  18. grpc_service:
  19. envoy_grpc:
  20. cluster_name: acme-ext-authz
  21. initial_metadata:
  22. - key: foo
  23. value: myauth.acme # required by local ext auth server.

A workload in the myns namespace needs to access a different ext_auth server that does not accept initial metadata. Since proto merge cannot remove fields, the following configuration uses the REPLACE operation. If you do not need to inherit fields, REPLACE is preferred over MERGE.

  1. apiVersion: networking.istio.io/v1alpha3
  2. kind: EnvoyFilter
  3. metadata:
  4. name: mysvc-ext-authz
  5. namespace: myns
  6. spec:
  7. workloadSelector:
  8. labels:
  9. app: mysvc
  10. configPatches:
  11. - applyTo: HTTP_FILTER
  12. match:
  13. context: SIDECAR_INBOUND
  14. patch:
  15. operation: REPLACE
  16. value:
  17. name: envoy.filters.http.ext_authz
  18. typed_config:
  19. "@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
  20. grpc_service:
  21. envoy_grpc:
  22. cluster_name: acme-ext-authz-alt

The following example deploys a Wasm extension for all inbound sidecar HTTP requests.

  1. apiVersion: networking.istio.io/v1alpha3
  2. kind: EnvoyFilter
  3. metadata:
  4. name: wasm-example
  5. namespace: myns
  6. spec:
  7. configPatches:
  8. # The first patch defines a named Wasm extension and provides a URL to fetch Wasm binary from,
  9. # and the binary configuration. It should come before the next patch that applies it.
  10. # This resource is visible to all proxies in the namespace "myns". It is possible to provide
  11. # multiple definitions for the same name "my-wasm-extension" in multiple namespaces. We recommend that:
  12. # - if overriding is desired, then the root level definition can be overriden per namespace with REPLACE.
  13. # - if overriding is not desired, then the name should be qualified with the namespace "myns/my-wasm-extension",
  14. # to avoid accidental name collisions.
  15. - applyTo: EXTENSION_CONFIG
  16. patch:
  17. operation: ADD # REPLACE is also supported, and would override a cluster level resource with the same name.
  18. value:
  19. name: my-wasm-extension
  20. typed_config:
  21. "@type": type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
  22. config:
  23. root_id: my-wasm-root-id
  24. vm_config:
  25. vm_id: my-wasm-vm-id
  26. runtime: envoy.wasm.runtime.v8
  27. code:
  28. remote:
  29. http_uri:
  30. uri: http://my-wasm-binary-uri
  31. configuration:
  32. "@type": "type.googleapis.com/google.protobuf.StringValue"
  33. value: |
  34. {}
  35. # The second patch instructs to apply the above Wasm filter to the listener/http connection manager.
  36. - applyTo: HTTP_FILTER
  37. match:
  38. listener:
  39. filterChain:
  40. filter:
  41. name: envoy.filters.network.http_connection_manager
  42. subFilter:
  43. name: envoy.filters.http.router
  44. patch:
  45. operation: INSERT_BEFORE
  46. value:
  47. name: my-wasm-extension # This must match the name above
  48. config_discovery:
  49. config_source:
  50. ads: {}
  51. type_urls: ["type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm"]

The following example adds a Wasm service extension for all proxies using a locally available Wasm file. The singleton Wasm extension is used to maintain a shared state between workers executing Wasm filters. For example, a local rate limit extension would rely on a singleton to limit requests across all workers. As another example, an authorization Wasm extension can use a singleton to maintain a database of accounts.

  1. apiVersion: networking.istio.io/v1alpha3
  2. kind: EnvoyFilter
  3. metadata:
  4. name: listener-filter-example
  5. namespace: myns
  6. spec:
  7. configPatches:
  8. - applyTo: LISTENER_FILTER
  9. patch:
  10. operation: MERGE
  11. value:
  12. bootstrap_extensions:
  13. - name: envoy.bootstrap.wasm
  14. typed_config:
  15. "@type": type.googleapis.com/envoy.extensions.wasm.v3.WasmService
  16. singleton: true
  17. config:
  18. name: my_plugin
  19. configuration:
  20. "@type": type.googleapis.com/google.protobuf.StringValue
  21. value: |
  22. {}
  23. vm_config:
  24. runtime: "envoy.wasm.runtime.v8"
  25. code:
  26. local:
  27. filename: "/etc/envoy_filter_http_wasm_example.wasm"

The following example inserts an envoy.filters.listener.proxy_protocol listener filter before the envoy.filters.listener.tls_inspector.

  1. apiVersion: networking.istio.io/v1alpha3
  2. kind: EnvoyFilter
  3. metadata:
  4. name: wasm-service
  5. namespace: myns
  6. spec:
  7. configPatches:
  8. - applyTo: LISTENER_FILTER
  9. match:
  10. context: SIDECAR_INBOUND # will match outbound listeners in all sidecars
  11. listener:
  12. portNumber: 15006
  13. listenerFilter: "envoy.filters.listener.tls_inspector"
  14. patch:
  15. operation: INSERT_BEFORE
  16. value:
  17. # This is the full filter config including the name and typed_config section.
  18. name: "envoy.filters.listener.proxy_protocol"
  19. typed_config:
  20. "@type": "type.googleapis.com/envoy.extensions.filters.listener.proxy_protocol.v3.ProxyProtocol"

EnvoyFilter

EnvoyFilter provides a mechanism to customize the Envoy configuration generated by Istio Pilot.

FieldTypeDescriptionRequired
workloadSelectorWorkloadSelector

Criteria used to select the specific set of pods/VMs on which this patch configuration should be applied. If omitted, the set of patches in this configuration will be applied to all workload instances in the same namespace. If omitted, the EnvoyFilter patches will be applied to all workloads in the same namespace. If the EnvoyFilter is present in the config root namespace, it will be applied to all applicable workloads in any namespace.

No
configPatchesEnvoyConfigObjectPatch[]

One or more patches with match conditions.

Yes
priorityint32

Priority defines the order in which patch sets are applied within a context. When one patch depends on another patch, the order of patch application is significant. The API provides two primary ways to order patches. Patch sets in the root namespace are applied before the patch sets in the workload namespace. Patches within a patch set are processed in the order that they appear in the configPatches list.

The default value for priority is 0 and the range is [ min-int32, max-int32 ]. A patch set with a negative priority is processed before the default. A patch set with a positive priority is processed after the default.

It is recommended to start with priority values that are multiples of 10 to leave room for further insertion.

Patch sets are sorted in the following ascending key order: priority, creation time, fully qualified resource name.

No

EnvoyFilter.ProxyMatch

One or more properties of the proxy to match on.

FieldTypeDescriptionRequired
proxyVersionstring

A regular expression in golang regex format (RE2) that can be used to select proxies using a specific version of istio proxy. The Istio version for a given proxy is obtained from the node metadata field ISTIO_VERSION supplied by the proxy when connecting to Pilot. This value is embedded as an environment variable (ISTIO_META_ISTIO_VERSION) in the Istio proxy docker image. Custom proxy implementations should provide this metadata variable to take advantage of the Istio version check option.

No
metadatamap<string, string>

Match on the node metadata supplied by a proxy when connecting to Istio Pilot. Note that while Envoy’s node metadata is of type Struct, only string key-value pairs are processed by Pilot. All keys specified in the metadata must match with exact values. The match will fail if any of the specified keys are absent or the values fail to match.

No

EnvoyFilter.ClusterMatch

Conditions specified in ClusterMatch must be met for the patch to be applied to a cluster.

FieldTypeDescriptionRequired
portNumberuint32

The service port for which this cluster was generated. If omitted, applies to clusters for any port. Note: for inbound cluster, it is the service target port.

No
servicestring

The fully qualified service name for this cluster. If omitted, applies to clusters for any service. For services defined through service entries, the service name is same as the hosts defined in the service entry. Note: for inbound cluster, this is ignored.

No
subsetstring

The subset associated with the service. If omitted, applies to clusters for any subset of a service.

No
namestring

The exact name of the cluster to match. To match a specific cluster by name, such as the internally generated Passthrough cluster, leave all fields in clusterMatch empty, except the name.

No

EnvoyFilter.RouteConfigurationMatch

Conditions specified in RouteConfigurationMatch must be met for the patch to be applied to a route configuration object or a specific virtual host within the route configuration.

FieldTypeDescriptionRequired
portNumberuint32

The service port number or gateway server port number for which this route configuration was generated. If omitted, applies to route configurations for all ports.

No
portNamestring

Applicable only for GATEWAY context. The gateway server port name for which this route configuration was generated.

No
gatewaystring

The Istio gateway config’s namespace/name for which this route configuration was generated. Applies only if the context is GATEWAY. Should be in the namespace/name format. Use this field in conjunction with the portNumber and portName to accurately select the Envoy route configuration for a specific HTTPS server within a gateway config object.

No
vhostVirtualHostMatch

Match a specific virtual host in a route configuration and apply the patch to the virtual host.

No
namestring

Route configuration name to match on. Can be used to match a specific route configuration by name, such as the internally generated http_proxy route configuration for all sidecars.

No

EnvoyFilter.ListenerMatch

Conditions specified in a listener match must be met for the patch to be applied to a specific listener across all filter chains, or a specific filter chain inside the listener.

FieldTypeDescriptionRequired
portNumberuint32

The service port/gateway port to which traffic is being sent/received. If not specified, matches all listeners. Even though inbound listeners are generated for the instance/pod ports, only service ports should be used to match listeners.

No
filterChainFilterChainMatch

Match a specific filter chain in a listener. If specified, the patch will be applied to the filter chain (and a specific filter if specified) and not to other filter chains in the listener.

No
listenerFilterstring

Match a specific listener filter. If specified, the patch will be applied to the listener filter.

No
namestring

Match a specific listener by its name. The listeners generated by Pilot are typically named as IP:Port.

No

EnvoyFilter.Patch

Patch specifies how the selected object should be modified.

FieldTypeDescriptionRequired
operationOperation

Determines how the patch should be applied.

No
valueStruct

The JSON config of the object being patched. This will be merged using proto merge semantics with the existing proto in the path.

No
filterClassFilterClass

Determines the filter insertion order.

No

EnvoyFilter.EnvoyConfigObjectMatch

One or more match conditions to be met before a patch is applied to the generated configuration for a given proxy.

FieldTypeDescriptionRequired
contextPatchContext

The specific config generation context to match on. Istio Pilot generates envoy configuration in the context of a gateway, inbound traffic to sidecar and outbound traffic from sidecar.

No
proxyProxyMatch

Match on properties associated with a proxy.

No
listenerListenerMatch (oneof)

Match on envoy listener attributes.

No
routeConfigurationRouteConfigurationMatch (oneof)

Match on envoy HTTP route configuration attributes.

No
clusterClusterMatch (oneof)

Match on envoy cluster attributes.

No

EnvoyFilter.EnvoyConfigObjectPatch

Changes to be made to various envoy config objects.

FieldTypeDescriptionRequired
applyToApplyTo

Specifies where in the Envoy configuration, the patch should be applied. The match is expected to select the appropriate object based on applyTo. For example, an applyTo with HTTP_FILTER is expected to have a match condition on the listeners, with a network filter selection on envoy.filters.network.http_connection_manager and a sub filter selection on the HTTP filter relative to which the insertion should be performed. Similarly, an applyTo on CLUSTER should have a match (if provided) on the cluster and not on a listener.

No
matchEnvoyConfigObjectMatch

Match on listener/route configuration/cluster.

No
patchPatch

The patch to apply along with the operation.

No

EnvoyFilter.RouteConfigurationMatch.RouteMatch

Match a specific route inside a virtual host in a route configuration.

FieldTypeDescriptionRequired
namestring

The Route objects generated by default are named as default. Route objects generated using a virtual service will carry the name used in the virtual service’s HTTP routes.

No
actionAction

Match a route with specific action type.

No

EnvoyFilter.RouteConfigurationMatch.VirtualHostMatch

Match a specific virtual host inside a route configuration.

FieldTypeDescriptionRequired
namestring

The VirtualHosts objects generated by Istio are named as host:port, where the host typically corresponds to the VirtualService’s host field or the hostname of a service in the registry.

No
routeRouteMatch

Match a specific route within the virtual host.

No

EnvoyFilter.ListenerMatch.FilterChainMatch

For listeners with multiple filter chains (e.g., inbound listeners on sidecars with permissive mTLS, gateway listeners with multiple SNI matches), the filter chain match can be used to select a specific filter chain to patch.

FieldTypeDescriptionRequired
namestring

The name assigned to the filter chain.

No
snistring

The SNI value used by a filter chain’s match condition. This condition will evaluate to false if the filter chain has no sni match.

No
transportProtocolstring

Applies only to SIDECAR_INBOUND context. If non-empty, a transport protocol to consider when determining a filter chain match. This value will be compared against the transport protocol of a new connection, when it’s detected by the tls_inspector listener filter.

Accepted values include:

  • raw_buffer - default, used when no transport protocol is detected.
  • tls - set when TLS protocol is detected by the TLS inspector.
No
applicationProtocolsstring

Applies only to sidecars. If non-empty, a comma separated set of application protocols to consider when determining a filter chain match. This value will be compared against the application protocols of a new connection, when it’s detected by one of the listener filters such as the http_inspector.

Accepted values include: h2, http/1.1, http/1.0

No
filterFilterMatch

The name of a specific filter to apply the patch to. Set this to envoy.filters.network.http_connection_manager to add a filter or apply a patch to the HTTP connection manager.

No
destinationPortuint32

The destination_port value used by a filter chain’s match condition. This condition will evaluate to false if the filter chain has no destination_port match.

No

EnvoyFilter.ListenerMatch.FilterMatch

Conditions to match a specific filter within a filter chain.

FieldTypeDescriptionRequired
namestring

The filter name to match on. For standard Envoy filters, canonical filter names should be used.

No
subFilterSubFilterMatch

The next level filter within this filter to match upon. Typically used for HTTP Connection Manager filters and Thrift filters.

No

EnvoyFilter.ListenerMatch.SubFilterMatch

Conditions to match a specific filter within another filter. This field is typically useful to match a HTTP filter inside the envoy.filters.network.http_connection_manager network filter. This could also be applicable for thrift filters.

FieldTypeDescriptionRequired
namestring

The filter name to match on.

No

EnvoyFilter.RouteConfigurationMatch.RouteMatch.Action

Action refers to the route action taken by Envoy when a http route matches.

NameDescription
ANY

All three route actions

ROUTE

Route traffic to a cluster / weighted clusters.

REDIRECT

Redirect request.

DIRECT_RESPONSE

directly respond to a request with specific payload.

EnvoyFilter.Patch.Operation

Operation denotes how the patch should be applied to the selected configuration.

NameDescription
INVALID
MERGE

Merge the provided config with the generated config using proto merge semantics. If you are specifying config in its entirety, use REPLACE instead.

ADD

Add the provided config to an existing list (of listeners, clusters, virtual hosts, network filters, or http filters). This operation will be ignored when applyTo is set to ROUTE_CONFIGURATION, or HTTP_ROUTE.

REMOVE

Remove the selected object from the list (of listeners, clusters, virtual hosts, network filters, routes, or http filters). Does not require a value to be specified. This operation will be ignored when applyTo is set to ROUTE_CONFIGURATION, or HTTP_ROUTE.

INSERT_BEFORE

Insert operation on an array of named objects. This operation is typically useful only in the context of filters or routes, where the order of elements matter. Routes should be ordered based on most to least specific matching criteria since the first matching element is selected. For clusters and virtual hosts, order of the element in the array does not matter. Insert before the selected filter or sub filter. If no filter is selected, the specified filter will be inserted at the front of the list.

INSERT_AFTER

Insert operation on an array of named objects. This operation is typically useful only in the context of filters or routes, where the order of elements matter. Routes should be ordered based on most to least specific matching criteria since the first matching element is selected. For clusters and virtual hosts, order of the element in the array does not matter. Insert after the selected filter or sub filter. If no filter is selected, the specified filter will be inserted at the end of the list.

INSERT_FIRST

Insert operation on an array of named objects. This operation is typically useful only in the context of filters or routes, where the order of elements matter. Routes should be ordered based on most to least specific matching criteria since the first matching element is selected. For clusters and virtual hosts, order of the element in the array does not matter. Insert first in the list based on the presence of selected filter or not. This is specifically useful when you want your filter first in the list based on a match condition specified in Match clause.

REPLACE

Replace contents of a named filter with new contents. REPLACE operation is only valid for HTTP_FILTER and NETWORK_FILTER. If the named filter is not found, this operation has no effect.

EnvoyFilter.Patch.FilterClass

FilterClass determines the filter insertion point in the filter chain relative to the filters implicitly inserted by the control plane. It is used in conjuction with the ADD operation. This is the preferred insertion mechanism for adding filters over the INSERT_* operations since those operations rely on potentially unstable filter names. Filter ordering is important if your filter depends on or affects the functioning of a another filter in the filter chain. Within a filter class, filters are inserted in the order of processing.

NameDescription
UNSPECIFIED

Control plane decides where to insert the filter. Do not specify FilterClass if the filter is independent of others.

AUTHN

Insert filter after Istio authentication filters.

AUTHZ

Insert filter after Istio authorization filters.

STATS

Insert filter before Istio stats filters.

EnvoyFilter.ApplyTo

ApplyTo specifies where in the Envoy configuration, the given patch should be applied.

NameDescription
INVALID
LISTENER

Applies the patch to the listener.

FILTER_CHAIN

Applies the patch to the filter chain.

NETWORK_FILTER

Applies the patch to the network filter chain, to modify an existing filter or add a new filter.

HTTP_FILTER

Applies the patch to the HTTP filter chain in the http connection manager, to modify an existing filter or add a new filter.

ROUTE_CONFIGURATION

Applies the patch to the Route configuration (rds output) inside a HTTP connection manager. This does not apply to the virtual host. Currently, only MERGE operation is allowed on the route configuration objects.

VIRTUAL_HOST

Applies the patch to a virtual host inside a route configuration.

HTTP_ROUTE

Applies the patch to a route object inside the matched virtual host in a route configuration.

CLUSTER

Applies the patch to a cluster in a CDS output. Also used to add new clusters.

EXTENSION_CONFIG

Applies the patch to or adds an extension config in ECDS output. Note that ECDS is only supported by HTTP filters.

BOOTSTRAP

Applies the patch to bootstrap configuration.

LISTENER_FILTER

Applies the patch to the listener filter.

EnvoyFilter.PatchContext

PatchContext selects a class of configurations based on the traffic flow direction and workload type.

NameDescription
ANY

All listeners/routes/clusters in both sidecars and gateways.

SIDECAR_INBOUND

Inbound listener/route/cluster in sidecar.

SIDECAR_OUTBOUND

Outbound listener/route/cluster in sidecar.

GATEWAY

Gateway listener/route/cluster.