Open mr-miles opened 9 months ago
Just to add, Currently a known limitation - https://developer.hashicorp.com/consul/docs/connect/gateways/terminating-gateway
Thanks @vijayraghav-io - I had read that as saying you couldn't filter the service instances hosted via a tgw, which is different. Also, I think it would aid developers if this limitation were also mentioned on the service-router / service-resolver pages since it is easy not to be thinking about this as a terminating gateway issue and so never come across the limitation.
Regardless, it seems like it almost works - is there any interest in a PR around it? If so, any pointers on the implementation?
hey @mr-miles sso this isn't particularly something we can do with terminating gateways, when you specify metadata for a service instance in the service mesh the metadata is copied on to the proxy sidecar instance for the service resolver lookup, when you do this with a terminating gateway it is essentially a single proxy for multiple service instances and there are a few issues that come up with that:
The fix for this can be in the documentation for service resolvers to add the note that if any instances are fronted by a terminating gateway that the filtering will be on the generated terminating gateway catalog entry and not the ultimate non-mesh service instance
Overview of the Issue
I have a service with instances directly available within the service mesh and externally registered. We are using the transparent proxy so those externally registered instances are reachable via the terminating gateway. This arrangement is because we are migrating services into the service mesh and updating them at the same time.
I want to use the service resolver to create a subset containing the externally-registered services and a second subset with those that have been migrated into the mesh. I added metadata to the external registration and expected
to pick them out but I consistently got no members in the envoy cluster of dependent services.
However I did get the right instances when (a random guess and I got lucky!) I used a filter expression of:
but although it worked on the source service, the subset on the terminating gateway itself was completely empty.
Combining both did yield the right result but is quite clunky and not very obvious!
It appears that the endpoint metadata used by the filter is overwritten with the terminating gateway metadata, for external endpoints.
I believe the correct behaviour would be for the filter expression to use the metadata of the relevant service instance metadata itself and not the terminating gateway that the instance is exposed through.
Reproduction Steps
Consul info for both Client and Server
EKS 1.28 Consul 1.17.3 Installed via helm chart Transparent proxy enabled Connect enabled