tcp_proxy: add support for subset load balancing (#8870)

Add support for subset load balancing into tcp_proxy

Risk Level: Medium
Testing: unit tests, integration tests, manual testing
Docs Changes: docs/root/configuration/listeners/network_filters/tcp_proxy_filter.rst
Release Notes: docs/root/intro/version_history.rst
Fixes #8769

This PR adds support for metadata_match field per weighted cluster, e.g.

name: envoy.tcp_proxy
typedConfig:
  '@type': type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy
  statPrefix: postgres.internal:5432
  weighted_clusters:
    clusters:
    - name: postgres.internal:5432
      metadata_match:              # implemented by this PR
        filter_metadata:
          envoy.lb:
            role: master
      weight: 10
    - name: postgres.internal:5432
      metadata_match:              # implemented by this PR
        filter_metadata:
          envoy.lb:
            role: replica
      weight: 90

Signed-off-by: Yaroslav Skopets <y.skopets@gmail.com>

Mirrored from https://github.com/envoyproxy/envoy @ 5536ce73026fcbf1c176c09d409a981d67981047
master-ci-test
data-plane-api(CircleCI) 5 years ago
parent df9f93694d
commit 32dfaebd2d
  1. 8
      envoy/config/filter/network/tcp_proxy/v2/tcp_proxy.proto
  2. 8
      envoy/config/filter/network/tcp_proxy/v3alpha/tcp_proxy.proto

@ -90,6 +90,14 @@ message TcpProxy {
// determined by its weight. The sum of weights across all entries in the
// clusters array determines the total weight.
uint32 weight = 2 [(validate.rules).uint32 = {gte: 1}];
// Optional endpoint metadata match criteria used by the subset load balancer. Only endpoints
// in the upstream cluster with metadata matching what is set in this field will be considered
// for load balancing. Note that this will be merged with what's provided in
// :ref:`TcpProxy.metadata_match
// <envoy_api_field_config.filter.network.tcp_proxy.v2.TcpProxy.metadata_match>`, with values
// here taking precedence. The filter name should be specified as *envoy.lb*.
api.v2.core.Metadata metadata_match = 3;
}
// Specifies one or more upstream clusters associated with the route.

@ -34,6 +34,14 @@ message TcpProxy {
// determined by its weight. The sum of weights across all entries in the
// clusters array determines the total weight.
uint32 weight = 2 [(validate.rules).uint32 = {gte: 1}];
// Optional endpoint metadata match criteria used by the subset load balancer. Only endpoints
// in the upstream cluster with metadata matching what is set in this field will be considered
// for load balancing. Note that this will be merged with what's provided in
// :ref:`TcpProxy.metadata_match
// <envoy_api_field_config.filter.network.tcp_proxy.v3alpha.TcpProxy.metadata_match>`, with
// values here taking precedence. The filter name should be specified as *envoy.lb*.
api.v3alpha.core.Metadata metadata_match = 3;
}
// Specifies one or more upstream clusters associated with the route.

Loading…
Cancel
Save