mirror of https://github.com/hashicorp/consul
00b5b0a0a2
The duo of `makeUpstreamFilterChainForDiscoveryChain` and `makeListenerForDiscoveryChain` were really hard to reason about, and led to concealing a bug in their branching logic. There were several issues here: - They tried to accomplish too much: determining filter name, cluster name, and whether RDS should be used. - They embedded logic to handle significantly different kinds of upstream listeners (passthrough, prepared query, typical services, and catch-all) - They needed to coalesce different data sources (Upstream and CompiledDiscoveryChain) Rather than handling all of those tasks inside of these functions, this PR pulls out the RDS/clusterName/filterName logic. This refactor also fixed a bug with the handling of [UpstreamDefaults](https://www.consul.io/docs/connect/config-entries/service-defaults#defaults). These defaults get stored as UpstreamConfig in the proxy snapshot with a DestinationName of "*", since they apply to all upstreams. However, this wildcard destination name must not be used when creating the name of the associated upstream cluster. The coalescing logic in the original functions here was in some situations creating clusters with a `*.` prefix, which is not a valid destination. |
||
---|---|---|
.. | ||
clusters | ||
endpoints | ||
listeners | ||
rbac | ||
routes | ||
alt-test-leaf-cert.golden | ||
alt-test-leaf-key.golden | ||
alt-test-root-cert.golden | ||
cache-test-leaf-cert.golden | ||
cache-test-leaf-key.golden | ||
db-test-leaf-cert.golden | ||
db-test-leaf-key.golden | ||
test-leaf-cert.golden | ||
test-leaf-key.golden | ||
test-root-cert.golden |