Backport of Fix resolution of service resolvers with subsets for external upstreams into release/1.15.x #16525
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport
This PR is auto-generated from #16499 to be assessed for backporting due to the inclusion of the label backport/1.15.
The below text is copied from the body of the original PR.
Description
While fixing #16498 I noticed that applying a
ServiceResolver
with subsets wasn't functional when referencing an external service proxied through aTerminatingGateway
as an upstream. I'm not too familiar with the way we return service health for external services, but the problem appears to be that in our health check materializer we:CheckServiceNode
values from our subscription, and thenSince we return the gateway associated with the service when we're using external services in conjuction with a
TerminatingGateway
:consul/agent/consul/state/catalog.go
Lines 2770 to 2782 in 21c3095
The filter never passes and we are never able to resolve the upstream endpoint properly.
I'm not entirely sure whether this is the only change needed, but from what I could tell all of the health checks initiated via
proxycfg
go through this code path since they leverage either the gRPC endpoints or a direct subscription to the in-memory store.Testing & Reproduction steps
Create a set of external services that has a
ServiceResolver
with subsets as in #16498 and a local service that leverages those services as an upstream. Hit the local proxy's admin cluster listing endpoint.Without the fix (no ip address ever associates with the endpoint):
With the fix (contains terminating gateway ip for its endpoint):
PR Checklist
Overview of commits