mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 13:55:55 +00:00
c9dbb6c51a
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.
143 lines
3.5 KiB
Plaintext
143 lines
3.5 KiB
Plaintext
{
|
|
"versionInfo": "00000001",
|
|
"resources": [
|
|
{
|
|
"@type": "type.googleapis.com/envoy.api.v2.Cluster",
|
|
"name": "alt.api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
|
"type": "LOGICAL_DNS",
|
|
"connectTimeout": "5s",
|
|
"loadAssignment": {
|
|
"clusterName": "alt.api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
|
"endpoints": [
|
|
{
|
|
"lbEndpoints": [
|
|
{
|
|
"endpoint": {
|
|
"address": {
|
|
"socketAddress": {
|
|
"address": "api.altdomain",
|
|
"portValue": 8081
|
|
}
|
|
}
|
|
},
|
|
"healthStatus": "HEALTHY",
|
|
"loadBalancingWeight": 1
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"tlsContext": {
|
|
"commonTlsContext": {
|
|
"tlsParams": {
|
|
|
|
},
|
|
"tlsCertificates": [
|
|
{
|
|
"certificateChain": {
|
|
"filename": "api.cert.pem"
|
|
},
|
|
"privateKey": {
|
|
"filename": "api.key.pem"
|
|
}
|
|
}
|
|
],
|
|
"validationContext": {
|
|
"trustedCa": {
|
|
"filename": "ca.cert.pem"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"dnsRefreshRate": "10s",
|
|
"dnsLookupFamily": "V4_ONLY",
|
|
"outlierDetection": {
|
|
|
|
}
|
|
},
|
|
{
|
|
"@type": "type.googleapis.com/envoy.api.v2.Cluster",
|
|
"name": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
|
"type": "LOGICAL_DNS",
|
|
"connectTimeout": "5s",
|
|
"loadAssignment": {
|
|
"clusterName": "api.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
|
"endpoints": [
|
|
{
|
|
"lbEndpoints": [
|
|
{
|
|
"endpoint": {
|
|
"address": {
|
|
"socketAddress": {
|
|
"address": "api.altdomain",
|
|
"portValue": 8081
|
|
}
|
|
}
|
|
},
|
|
"healthStatus": "HEALTHY",
|
|
"loadBalancingWeight": 1
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"tlsContext": {
|
|
"commonTlsContext": {
|
|
"tlsParams": {
|
|
|
|
},
|
|
"tlsCertificates": [
|
|
{
|
|
"certificateChain": {
|
|
"filename": "api.cert.pem"
|
|
},
|
|
"privateKey": {
|
|
"filename": "api.key.pem"
|
|
}
|
|
}
|
|
],
|
|
"validationContext": {
|
|
"trustedCa": {
|
|
"filename": "ca.cert.pem"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"dnsRefreshRate": "10s",
|
|
"dnsLookupFamily": "V4_ONLY",
|
|
"outlierDetection": {
|
|
|
|
}
|
|
},
|
|
{
|
|
"@type": "type.googleapis.com/envoy.api.v2.Cluster",
|
|
"name": "web.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
|
|
"type": "EDS",
|
|
"edsClusterConfig": {
|
|
"edsConfig": {
|
|
"ads": {
|
|
|
|
}
|
|
}
|
|
},
|
|
"connectTimeout": "5s",
|
|
"tlsContext": {
|
|
"commonTlsContext": {
|
|
"tlsParams": {
|
|
|
|
},
|
|
"validationContext": {
|
|
"trustedCa": {
|
|
"filename": "ca.cert.pem"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"outlierDetection": {
|
|
|
|
}
|
|
}
|
|
],
|
|
"typeUrl": "type.googleapis.com/envoy.api.v2.Cluster",
|
|
"nonce": "00000001"
|
|
} |