open-consul/agent/xds
Freddy 66e2def461
Only pass one hostname via EDS and prefer healthy ones (#8084)
Co-authored-by: Matt Keeler <mkeeler@users.noreply.github.com>

Currently when passing hostname clusters to Envoy, we set each service instance registered with Consul as an LbEndpoint for the cluster.

However, Envoy can only handle one per cluster:
[2020-06-04 18:32:34.094][1][warning][config] [source/common/config/grpc_subscription_impl.cc:87] gRPC config for type.googleapis.com/envoy.api.v2.Cluster rejected: Error adding/updating cluster(s) dc2.internal.ddd90499-9b47-91c5-4616-c0cbf0fc358a.consul: LOGICAL_DNS clusters must have a single locality_lb_endpoint and a single lb_endpoint, server.dc2.consul: LOGICAL_DNS clusters must have a single locality_lb_endpoint and a single lb_endpoint

Envoy is currently handling this gracefully by only picking one of the endpoints. However, we should avoid passing multiple to avoid these warning logs.

This PR:

* Ensures we only pass one endpoint, which is tied to one service instance.
* We prefer sending an endpoint which is marked as Healthy by Consul.
* If no endpoints are healthy we emit a warning and skip the cluster.
* If multiple unique hostnames are spread across service instances we emit a warning and let the user know which will be resolved.
2020-06-12 13:46:17 -06:00
..
testdata Only pass one hostname via EDS and prefer healthy ones (#8084) 2020-06-12 13:46:17 -06:00
clusters.go Only pass one hostname via EDS and prefer healthy ones (#8084) 2020-06-12 13:46:17 -06:00
clusters_test.go Enable gateways to resolve hostnames to IPv4 addresses (#7999) 2020-06-03 15:28:45 -06:00
config.go config: add HookWeakDecodeFromSlice 2020-06-08 17:05:09 -04:00
config_test.go Enable gateways to resolve hostnames to IPv4 addresses (#7999) 2020-06-03 15:28:45 -06:00
endpoints.go Enable gateways to resolve hostnames to IPv4 addresses (#7999) 2020-06-03 15:28:45 -06:00
endpoints_test.go connect: fix endpoints clusterName when using cluster escape hatch (#7319) 2020-05-26 10:57:22 +02:00
failover_math.go connect: fix failover through a mesh gateway to a remote datacenter (#6259) 2019-08-05 13:30:35 -05:00
failover_math_test.go connect: fix failover through a mesh gateway to a remote datacenter (#6259) 2019-08-05 13:30:35 -05:00
golden_test.go Connect: allow configuring Envoy for L7 Observability (#5558) 2019-04-29 17:27:57 +01:00
listeners.go Standardize support for Tagged and BindAddresses in Ingress Gateways (#7924) 2020-05-21 09:08:12 -05:00
listeners_test.go Enable gateways to resolve hostnames to IPv4 addresses (#7999) 2020-06-03 15:28:45 -06:00
naming.go connect: generate the full SNI names for discovery targets in the compiler rather than in the xds package (#6340) 2019-08-19 13:03:03 -05:00
response.go activate most discovery chain features in xDS for envoy (#6024) 2019-07-01 22:10:51 -05:00
routes.go Always require Host header values for http services (#7990) 2020-06-08 13:16:24 -05:00
routes_test.go Allow Hosts field to be set on an ingress config entry 2020-05-06 15:06:13 -05:00
server.go Allow ingress gateways to send empty clusters, routes, and listeners (#7795) 2020-05-07 16:19:25 -05:00
server_oss.go Updates to Config Entries and Connect for Namespaces (#7116) 2020-01-24 10:04:58 -05:00
server_test.go Allow ingress gateways to send empty clusters, routes, and listeners (#7795) 2020-05-07 16:19:25 -05:00
testing.go Upgrade xDS (go-control-plane) API to support Envoy 1.10. (#5872) 2019-06-07 07:10:43 -05:00
xds.go Remove unused customEDSClusterJSON 2020-03-27 15:38:16 -04:00