Allow custom local address resolvers. (#27705)
* Allow custom local address resolvers. #27881 introduces the concept of EDS clusters with hosts that have multiple (potentially > 2) IP addresses. The current implementation of UpstreamLocalAddressSelector limits the number of source addresses in BindConfig artificially to 2, and further requires that the addresses be of different address families. The workaround for this (if we need to specify more than 2 source addresses or have multiple addresses from the same family) is to use a custom address resolver that resolves the bind config address to nullptr (and therefore ignore it) and call bind in a customised SocketInterfaceImpl to a local source address determined by the SocketInterfaceImpl specialisation. This PR makes it possible to define a custom local address selector, that makes it easy to work with a custom address resolver to pick the right source address based on the upstream address selected by HappyEyeballsConnectionImpl Signed-off-by: pcrao <pcrao@google.com> Mirrored from https://github.com/envoyproxy/envoy @ da47a54a8ccbaa384c4cb62a5f4fcd4745a72c37main
parent
fc90f1b72c
commit
9d38187abc
5 changed files with 53 additions and 8 deletions
@ -0,0 +1,9 @@ |
||||
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. |
||||
|
||||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") |
||||
|
||||
licenses(["notice"]) # Apache 2 |
||||
|
||||
api_proto_package( |
||||
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"], |
||||
) |
@ -0,0 +1,31 @@ |
||||
syntax = "proto3"; |
||||
|
||||
package envoy.config.upstream.local_address_selector.v3; |
||||
|
||||
import "udpa/annotations/status.proto"; |
||||
|
||||
option java_package = "io.envoyproxy.envoy.config.upstream.local_address_selector.v3"; |
||||
option java_outer_classname = "DefaultLocalAddressSelectorProto"; |
||||
option java_multiple_files = true; |
||||
option go_package = "github.com/envoyproxy/go-control-plane/envoy/config/upstream/local_address_selector/v3;local_address_selectorv3"; |
||||
option (udpa.annotations.file_status).package_version_status = ACTIVE; |
||||
|
||||
// [#protodoc-title: Default Local Address Selector] |
||||
// [#extension: envoy.upstream.local_address_selector.default_local_address_selector] |
||||
|
||||
// Default implementation of a local address selector. This implementation is |
||||
// used if :ref:`local_address_selector |
||||
// <envoy_v3_api_field_config.core.v3.BindConfig.local_address_selector>` is not |
||||
// specified. |
||||
// This implementation supports the specification of only one address in |
||||
// :ref:`extra_source_addresses |
||||
// <envoy_v3_api_field_config.core.v3.BindConfig.extra_source_addresses>` which |
||||
// is appended to the address specified in the |
||||
// :ref:`source_address <envoy_v3_api_field_config.core.v3.BindConfig.source_address>` |
||||
// field. The extra address should have a different IP version than the address in the |
||||
// `source_address` field. The address which has the same IP |
||||
// version with the target host's address IP version will be used as bind address. |
||||
// If there is no same IP version address found, the address in the `source_address` field will |
||||
// be returned. |
||||
message DefaultLocalAddressSelector { |
||||
} |
Loading…
Reference in new issue