Connect to every instance of a service through mesh network

Hi there,

I’m setting up a 2 datacenter cluster where I’ll have a service called indexer on dc1 and a service called backend that has instances in both dc1 and dc2.

Each server has its own consul client and has a bunch of docker containers managed via docker compose. For each of those containers I’ve setup a sidecar container that connects to the local consul client in the server and expose a service instance.

Now, I would like to make it so that the indexer can connect to each of the backend instances singularly as they all have their own data that the indexer has to read.

I think I could probably create an upstream like this in the indexer config for each backend service ids but that’s not ideal, I would like to possible just add another backend at some point without changing the indexer config.

Is it possible to have the indexer discover the backend services and connect to them (through the mesh network so through the sidecar) indipendently?

Anyone has any idea?