fabiolb / fabio

Consul Load-Balancing made simple
https://fabiolb.net
MIT License
7.25k stars 621 forks source link

Difficulty supporting multiple grpc routes #846

Open Jake-S6 opened 2 years ago

Jake-S6 commented 2 years ago

If I setup a service using the tag urlprefix-/ proto=grpc grpcservername=my.first.service I am able to hit it using grpcurl -plaintext 127.0.0.1:5555 my.first.service/MyMethod. However, if I try to add another route with the tag urlprefix-/ proto=grpc grpcservername=my.second.service, only one of the services is reachable. Which I assume is due to the urlprefix-/ global rouote taking all grpc traffic and makes sense.

But if I try the tag urlprefix-/my.first.service proto=grpc or urlprefix-/my.first.service proto=grpc grpcservername=my.first.service then the grpcurl command above fails. Even though the destination in the route for /my.first.service listed in the Fabio UI (i.e. the part after "grpc://") is reachable directly through grpcurl.

Is there some other address than 127.0.0.1:5555 that I need to use when adding the service name to the urlprefix?

Jake-S6 commented 2 years ago

@andyroyle I know you worked in this space. If there is any chance you could point me in a direction to get unblocked, that would be much appreciated.

tristanmorgan commented 2 years ago

Would urlprefix-my.first.service/ proto=grpc be the trick? With the slash after the hostname. (or is that only for SNI sniffing?)

Jake-S6 commented 2 years ago

Would urlprefix-my.first.service/ proto=grpc be the trick? With the slash after the hostname. (or is that only for SNI sniffing?)

Thanks, I will give that a try. I didn't see that format in the docs though: https://fabiolb.net/feature/grpc-proxy/

tristanmorgan commented 2 years ago

Sorry, I think I gave some bad advice. I was just having a dig through the docs and saw

host matching is not supported for GRPC proxying.

so it seems the switching needs to happen on the method names. The grpcservername part is for dealing with the upstream name validation.

Jake-S6 commented 2 years ago

I tried urlprefix-my.first.service/ proto=grpc and urlprefix-/my.first.service/MyMethod and the grpcurl call still fails. Thanks for the suggestions though.