Careful!
You are browsing documentation for a version of Kuma that is not the latest release.
MeshProxyPatch
The MeshProxyPatch
provides configuration options for low-level Envoy resources that Kuma policies do not directly expose.
If you need features that aren’t available as a Kuma policy, open a new issue on GitHub so they can be added to the Kuma roadmap.
A MeshProxyPatch
policy can modify:
This policy uses a new policy matching algorithm. Do not combine with Proxy Template.
targetRef
support matrix
targetRef |
Allowed kinds |
---|---|
targetRef.kind |
Mesh , MeshSubset , MeshService , MeshServiceSubset |
To learn more about the information in this table, see the matching docs.
Configuration
Modifications
MeshProxyPatch
lets you specify modifications in appendModification
block that can add a new resource, patch an existing resource or remove an existing resource.
Each xDS resource modification consists of 3 fields:
operation
- operation applied to the generated config (for example:Add
,Remove
,Patch
).match
- some operations can be applied on matched resources (for example: remove only resource of given name, patch all outbound resources).
and one of
jsonPatches
- list of modifications in JSON Patch notation.value
- raw Envoy xDS configuration. Can be partial if operation ispatch
.
Origin
All resources generated by Kuma are marked with the origin
value, so you can match specific resources.
Examples: add new filters but only on inbound listeners, set timeouts on outbound clusters.
Well known origins:
inbound
- resources generated for incoming traffic.outbound
- resources generated for outgoing traffic.transparent
- resources generated for transparent proxy functionality.prometheus
- resources generated for Prometheus to scrape when metrics on the Mesh is enabled.direct-access
- resources generated for Direct Access functionality.gateway
- resources generated for MeshGateway.
The list is not complete, as policy plugins can introduce new resources.
For example MeshTrace plugin can create Cluster
with mesh-trace
origin.
Cluster
Modifications that are applied on Clusters resources.
Available operations:
Add
- add a new Cluster or replace existing if the name is the same.Remove
- remove a Cluster.Patch
- patch a part of Cluster definition.
Available matchers:
name
- name of the Cluster.origin
- origin of the Cluster.
Listener
Modifications that are applied on Listeners resources.
Available operations:
Add
- add a new Listener or replace existing if the name is the same.Remove
- remove a Listener.Patch
- patch a part of Listener definition.
Available matchers:
name
- name of the Listener.origin
- origin of the Listener.tags
- tags of inbound or outbound Listeners. They matchListener.metadata.filterMetadata[io.kuma.tags]
in XDS configuration.
Network Filter
Modifications that are applied on Network Filters that are part of Listeners resource. Modifications are applied on all Filter Chains in the Listener.
Available operations:
AddFirst
- add a new filter as a first filter in Filter Chain.AddLast
- add a new filter as a last filter in Filter Chain.AddAfter
- add a new filter after other filter in Filter Chain that is matched usingmatch
section.AddBefore
- add a new filter before other filter in Filter Chain that is matched usingmatch
section.Patch
- patch a matched filter in Filter Chain.Remove
- remove a filter in Filter Chain.
Available matchers:
name
- name of the Network Filter.listenerName
- name of the Listener.listenerTags
- tags of inbound or outbound Listeners. They matchListener.metadata.filterMetadata[io.kuma.tags]
in XDS configuration.origin
- origin of the Listener.
HTTP Filter
Modifications that are applied on HTTP Filters that are part of Listeners resource. Modifications that Kuma applies on all HTTP Connection Managers in the Listener.
HTTP Filter modifications can only be applied on services configured as HTTP.
Available operations:
AddFirst
- add a new filter as a first filter in HTTP Connection Manager.AddLast
- add a new filter as a last filter in HTTP Connection Manager.AddAfter
- add a new filter after other filter in HTTP Connection Manager that is matched usingmatch
section.AddBefore
- add a new filter before other filter in HTTP Connection Manager that is matched usingmatch
section.Patch
- patch a matched filter in HTTP Connection Manager.Remove
- remove a filter in HTTP Connection Manager.
Available matchers:
name
- name of the HTTP Filter.listenerName
- name of the Listener.listenerTags
- tags of inbound or outbound Listeners. They matchListener.metadata.filterMetadata[io.kuma.tags]
in XDS configuration.origin
- origin of the Listener.
VirtualHost
Modifications that are applied on VirtualHost resources.
VirtualHost modifications can only be applied on services configured as HTTP.
Available operations:
Add
- add a new VirtualHost.Remove
- remove a VirtualHost.Patch
- patch a part of VirtualHost definition.
Available matchers:
name
- name of the VirtualHost.origin
- origin of the VirtualHost.routeConfigurationName
- name of the RouteConfiguration.
Merging
All modifications from appendModification
list are always merged.
For example, if there is a policy with targetRef.kind: Mesh
and second policy with targetRef.kind: MeshService
that matches a data plane proxy,
all modifications from both policies will be applied.
JSONPatch
If you use JSONPatch, remember to always use camelCase instead of snake_case in path
parameter even though you see snake_case in Envoy Config Dump.
Examples
Timeout adjustment for MeshGateway
Example how to change streamIdleTimeout
for MeshGateway
:
lua filter
Here is and example of lua filter that adds the new x-header: test
header to all outgoing HTTP requests to service offers
.
All policy options
Spec is the specification of the Kuma MeshProxyPatch resource.
Type: object
Properties
default
required
- Default is a configuration specific to the group of destinationsreferenced in 'targetRef'.
- Type:
object
- Properties
- appendModifications
required
- AppendModifications is a list of modifications applied on the selected proxy.
- Type:
array
- Items
- Type:
object
- Properties
- cluster
- Cluster is a modification of Envoy's Cluster resource.
- Type:
object
- Properties
- jsonPatches
- JsonPatches specifies list of jsonpatches to apply to on Envoy's Clusterresource
- Type:
array
- Items
- JsonPatchBlock is one json patch operation block.
- Type:
object
- Properties
- from
- From is a jsonpatch from string, used by move and copy operations.
- Type:
string
- op
required
- Op is a jsonpatch operation string.
- Type:
string
- The value is restricted to the following:
- "add"
- "remove"
- "replace"
- "move"
- "copy"
- path
required
- Path is a jsonpatch path string.
- Type:
string
- value
- Value must be a valid json value used by replace and add operations.
- from
- match
- Match is a set of conditions that have to be matched for modification operation to happen.
- Type:
object
- Properties
- name
- Name of the cluster to match.
- Type:
string
- origin
- Origin is the name of the component or plugin that generated the resource.Here is the list of well-known origins:inbound - resources generated for handling incoming traffic.outbound - resources generated for handling outgoing traffic.transparent - resources generated for transparent proxy functionality.prometheus - resources generated when Prometheus metrics are enabled.direct-access - resources generated for Direct Access functionality.ingress - resources generated for Zone Ingress.egress - resources generated for Zone Egress.gateway - resources generated for MeshGateway.The list is not complete, because policy plugins can introduce new resources.For example MeshTrace plugin can create Cluster with "mesh-trace" origin.
- Type:
string
- name
- operation
required
- Operation to execute on matched cluster.
- Type:
string
- The value is restricted to the following:
- "Add"
- "Remove"
- "Patch"
- value
- Value of xDS resource in YAML format to add or patch.
- Type:
string
- jsonPatches
- httpFilter
- HTTPFilter is a modification of Envoy HTTP Filteravailable in HTTP Connection Manager in a Listener resource.
- Type:
object
- Properties
- jsonPatches
- JsonPatches specifies list of jsonpatches to apply to on Envoy'sHTTP Filter available in HTTP Connection Manager in a Listener resource.
- Type:
array
- Items
- JsonPatchBlock is one json patch operation block.
- Type:
object
- Properties
- from
- From is a jsonpatch from string, used by move and copy operations.
- Type:
string
- op
required
- Op is a jsonpatch operation string.
- Type:
string
- The value is restricted to the following:
- "add"
- "remove"
- "replace"
- "move"
- "copy"
- path
required
- Path is a jsonpatch path string.
- Type:
string
- value
- Value must be a valid json value used by replace and add operations.
- from
- match
- Match is a set of conditions that have to be matched for modification operation to happen.
- Type:
object
- Properties
- listenerName
- Name of the listener to match.
- Type:
string
- listenerTags
- Listener tags available in Listener#Metadata#FilterMetadata[io.kuma.tags]
- Type:
object
- This schema accepts additional properties.
- Properties
- name
- Name of the HTTP filter. For example "envoy.filters.http.local_ratelimit"
- Type:
string
- origin
- Origin is the name of the component or plugin that generated the resource.Here is the list of well-known origins:inbound - resources generated for handling incoming traffic.outbound - resources generated for handling outgoing traffic.transparent - resources generated for transparent proxy functionality.prometheus - resources generated when Prometheus metrics are enabled.direct-access - resources generated for Direct Access functionality.ingress - resources generated for Zone Ingress.egress - resources generated for Zone Egress.gateway - resources generated for MeshGateway.The list is not complete, because policy plugins can introduce new resources.For example MeshTrace plugin can create Cluster with "mesh-trace" origin.
- Type:
string
- listenerName
- operation
required
- Operation to execute on matched listener.
- Type:
string
- The value is restricted to the following:
- "Remove"
- "Patch"
- "AddFirst"
- "AddBefore"
- "AddAfter"
- "AddLast"
- value
- Value of xDS resource in YAML format to add or patch.
- Type:
string
- jsonPatches
- listener
- Listener is a modification of Envoy's Listener resource.
- Type:
object
- Properties
- jsonPatches
- JsonPatches specifies list of jsonpatches to apply to on Envoy's Listenerresource
- Type:
array
- Items
- JsonPatchBlock is one json patch operation block.
- Type:
object
- Properties
- from
- From is a jsonpatch from string, used by move and copy operations.
- Type:
string
- op
required
- Op is a jsonpatch operation string.
- Type:
string
- The value is restricted to the following:
- "add"
- "remove"
- "replace"
- "move"
- "copy"
- path
required
- Path is a jsonpatch path string.
- Type:
string
- value
- Value must be a valid json value used by replace and add operations.
- from
- match
- Match is a set of conditions that have to be matched for modification operation to happen.
- Type:
object
- Properties
- name
- Name of the listener to match.
- Type:
string
- origin
- Origin is the name of the component or plugin that generated the resource.Here is the list of well-known origins:inbound - resources generated for handling incoming traffic.outbound - resources generated for handling outgoing traffic.transparent - resources generated for transparent proxy functionality.prometheus - resources generated when Prometheus metrics are enabled.direct-access - resources generated for Direct Access functionality.ingress - resources generated for Zone Ingress.egress - resources generated for Zone Egress.gateway - resources generated for MeshGateway.The list is not complete, because policy plugins can introduce new resources.For example MeshTrace plugin can create Cluster with "mesh-trace" origin.
- Type:
string
- tags
- Tags available in Listener#Metadata#FilterMetadata[io.kuma.tags]
- Type:
object
- This schema accepts additional properties.
- Properties
- name
- operation
required
- Operation to execute on matched listener.
- Type:
string
- The value is restricted to the following:
- "Add"
- "Remove"
- "Patch"
- value
- Value of xDS resource in YAML format to add or patch.
- Type:
string
- jsonPatches
- networkFilter
- NetworkFilter is a modification of Envoy Listener's filter.
- Type:
object
- Properties
- jsonPatches
- JsonPatches specifies list of jsonpatches to apply to on Envoy Listener'sfilter.
- Type:
array
- Items
- JsonPatchBlock is one json patch operation block.
- Type:
object
- Properties
- from
- From is a jsonpatch from string, used by move and copy operations.
- Type:
string
- op
required
- Op is a jsonpatch operation string.
- Type:
string
- The value is restricted to the following:
- "add"
- "remove"
- "replace"
- "move"
- "copy"
- path
required
- Path is a jsonpatch path string.
- Type:
string
- value
- Value must be a valid json value used by replace and add operations.
- from
- match
- Match is a set of conditions that have to be matched for modification operation to happen.
- Type:
object
- Properties
- listenerName
- Name of the listener to match.
- Type:
string
- listenerTags
- Listener tags available in Listener#Metadata#FilterMetadata[io.kuma.tags]
- Type:
object
- This schema accepts additional properties.
- Properties
- name
- Name of the network filter. For example "envoy.filters.network.ratelimit"
- Type:
string
- origin
- Origin is the name of the component or plugin that generated the resource.Here is the list of well-known origins:inbound - resources generated for handling incoming traffic.outbound - resources generated for handling outgoing traffic.transparent - resources generated for transparent proxy functionality.prometheus - resources generated when Prometheus metrics are enabled.direct-access - resources generated for Direct Access functionality.ingress - resources generated for Zone Ingress.egress - resources generated for Zone Egress.gateway - resources generated for MeshGateway.The list is not complete, because policy plugins can introduce new resources.For example MeshTrace plugin can create Cluster with "mesh-trace" origin.
- Type:
string
- listenerName
- operation
required
- Operation to execute on matched listener.
- Type:
string
- The value is restricted to the following:
- "Remove"
- "Patch"
- "AddFirst"
- "AddBefore"
- "AddAfter"
- "AddLast"
- value
- Value of xDS resource in YAML format to add or patch.
- Type:
string
- jsonPatches
- virtualHost
- VirtualHost is a modification of Envoy's VirtualHostreferenced in HTTP Connection Manager in a Listener resource.
- Type:
object
- Properties
- jsonPatches
- JsonPatches specifies list of jsonpatches to apply to on Envoy'sVirtualHost resource
- Type:
array
- Items
- JsonPatchBlock is one json patch operation block.
- Type:
object
- Properties
- from
- From is a jsonpatch from string, used by move and copy operations.
- Type:
string
- op
required
- Op is a jsonpatch operation string.
- Type:
string
- The value is restricted to the following:
- "add"
- "remove"
- "replace"
- "move"
- "copy"
- path
required
- Path is a jsonpatch path string.
- Type:
string
- value
- Value must be a valid json value used by replace and add operations.
- from
- match
required
- Match is a set of conditions that have to be matched for modification operation to happen.
- Type:
object
- Properties
- name
- Name of the VirtualHost to match.
- Type:
string
- origin
- Origin is the name of the component or plugin that generated the resource.Here is the list of well-known origins:inbound - resources generated for handling incoming traffic.outbound - resources generated for handling outgoing traffic.transparent - resources generated for transparent proxy functionality.prometheus - resources generated when Prometheus metrics are enabled.direct-access - resources generated for Direct Access functionality.ingress - resources generated for Zone Ingress.egress - resources generated for Zone Egress.gateway - resources generated for MeshGateway.The list is not complete, because policy plugins can introduce new resources.For example MeshTrace plugin can create Cluster with "mesh-trace" origin.
- Type:
string
- routeConfigurationName
- Name of the RouteConfiguration resource to match.
- Type:
string
- name
- operation
required
- Operation to execute on matched listener.
- Type:
string
- The value is restricted to the following:
- "Add"
- "Remove"
- "Patch"
- value
- Value of xDS resource in YAML format to add or patch.
- Type:
string
- jsonPatches
- cluster
- appendModifications
targetRef
required
TargetRef is a reference to the resource the policy takes an effect on.The resource could be either a real store object or virtual resourcedefined inplace.
Type:
object
Properties
kind
- Kind of the referenced resource
- Type:
string
- The value is restricted to the following:
- "Mesh"
- "MeshSubset"
- "MeshGateway"
- "MeshService"
- "MeshExternalService"
- "MeshServiceSubset"
- "MeshHTTPRoute"
labels
- Labels are used to select group of MeshServices that match labels. Either Labels orName and Namespace can be used.
- Type:
object
- This schema accepts additional properties.
- Properties
mesh
- Mesh is reserved for future use to identify cross mesh resources.
- Type:
string
name
- Name of the referenced resource. Can only be used with kinds:
MeshService
,MeshServiceSubset
andMeshGatewayRoute
- Type:
string
- Name of the referenced resource. Can only be used with kinds:
namespace
- Namespace specifies the namespace of target resource. If empty only resources in policy namespacewill be targeted.
- Type:
string
proxyTypes
ProxyTypes specifies the data plane types that are subject to the policy. When not specified,all data plane types are targeted by the policy.
Type:
array
Item Count: ≥ 1
- Items
- Type:
string
- The value is restricted to the following:
- "Sidecar"
- "Gateway"
sectionName
- SectionName is used to target specific section of resource.For example, you can target port from MeshService.ports[] by its name. Only traffic to this port will be affected.
- Type:
string
tags
- Tags used to select a subset of proxies by tags. Can only be used with kinds
MeshSubset
andMeshServiceSubset
- Type:
object
- This schema accepts additional properties.
- Properties
- Tags used to select a subset of proxies by tags. Can only be used with kinds
Generated with json-schema-md-doc Fri Apr 11 2025 14:34:58 GMT+0000 (Coordinated Universal Time)