consul/agent/proxycfg
Freddy 166a8b2a58
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
..
manager.go Add service id context to the proxycfg logger 2020-05-18 09:08:05 -05:00
manager_test.go Merge pull request #7759 from hashicorp/ingress/tls-hosts 2020-05-11 09:18:43 -07:00
proxycfg.go Proxy Config Manager (#4729) 2018-10-10 16:55:34 +01:00
snapshot.go Enable gateways to resolve hostnames to IPv4 addresses (#7999) 2020-06-03 15:28:45 -06:00
state.go Only pass one hostname via EDS and prefer healthy ones (#8084) 2020-06-12 13:46:17 -06:00
state_test.go Enable gateways to resolve hostnames to IPv4 addresses (#7999) 2020-06-03 15:28:45 -06:00
testing.go Enable gateways to resolve hostnames to IPv4 addresses (#7999) 2020-06-03 15:28:45 -06:00