Netflix / zuul

Zuul is a gateway service that provides dynamic routing, monitoring, resiliency, security, and more.
Apache License 2.0
13.44k stars 2.37k forks source link

[Question]: Multi Tenant Upstream Support #400

Open sandy-adi opened 6 years ago

sandy-adi commented 6 years ago

Hi Team,

I’ve the following use case:

I’ve an api let’s say identified by the uri /service/function/operation and there are different upstream tenants that provide the same API. So, lets say

User 1,2,3 are served by tenant A User 4,5,6 are served by tenant B User 7,8,9 are served by tenant C

The upstream provider for a specific user will be determined by an authorization engine.

I’ve a few questions in this regard:

How do I go about the adding and configuring the providers for this use case?

On a side note is there a community forum where I can reach out for questions or is github issues the right forum?

artgon commented 6 years ago

Are you using Zuul 1 or Zuul 2? Eureka or no?

sandy-adi commented 6 years ago

Thanks for your response @artgon I was using Zuul1, with Consul. It looked like it was not possible with Zuul1. I just started looking at Zuul2. it is so hard to get a hang of the documentation, it seems to be all over the place. what's a good place where I can get information about zuul2

artgon commented 6 years ago

No documentation yet, it'll be coming shortly. Best bet for Z2 right now is the sample app.

Someone else had a similar question earlier, see if helps: https://github.com/Netflix/zuul/issues/395

sandy-adi commented 6 years ago

Thanks @artgon I'll check it out

sandy-adi commented 6 years ago

@artgon what am I doing wrong? I ran gradle jar within the zuul-sample directory. Then I tried running the sample app as below:

$ java -cp build/libs/zuul-sample-2.2.0-SNAPSHOT.jar com.netflix.zuul.sample.Bootstrap
artgon commented 6 years ago

Added a run task to the sample (https://github.com/Netflix/zuul/commit/1baf63ab1f4a2326a6b6c4c03809e596ce3df4f5)

You can run it from the root directly with the command ./gradlew run.

sandy-adi commented 6 years ago

Perfect! Thanks @artgon

sandy-adi commented 6 years ago

@artgon I setup a local instance of eureka and modified the configuration on the sample app to point to the local instance of eureka, it appears like zuul is picking up the instances registered on eureka

2018-03-08 02:11:21,952 INFO  com.netflix.discovery.DiscoveryClient [main] Discovery Client initialized at timestamp 1520493081950 with initial instances count: 4
2018-03-08 02:11:22,058 WARN  com.netflix.zuul.netty.server.BaseServerStartup [main] Configured port: 7001

however, I'm not able to figure out how to access the APIs on those instances via zuul.

I tried http://localhost:7001/instanceid/apiuri, but that didn't work