istio / old_mixer_repo

Deprecated home of Istio's Mixer and its adapters, now in istio/istio's mixer dir
https://github.com/istio/istio/tree/master/mixer
Apache License 2.0
67 stars 93 forks source link

Dynamic request routing support #495

Open galo opened 7 years ago

galo commented 7 years ago

Sorry if this is not the right location for this topic, feel free to close so I can ask this in a different place.

One use case I am trying to design is dynamic routing of HTTP requests based on some information that is part of the URL path, query string or header (ie jwt claim).

A common scenario for this is sharding or routing requests to the right data center based on a userId, or some other routing key. We have this model implemented using other proxies like Zuul or APIgee Microgateway using a filter or plugin in the proxy, the routing key is extracted and we query a lookup system where we register the mapping between routingKey and service instances. In our case we use the entity locator service a DynamoDB backed that also contains which instances are read, vs write, etc.

I would like to validate what is the best way on the Istio model to implement this use case. I think there can be two models, but correct me if I am totally wrong

If this use case makes sense to more people I can do a PR following your design guidelines.

geeknoid commented 7 years ago

Your #2 feels like the right choice for Istio. The mixer is able to return attributes back to the proxy, which the proxy can use in routing decisions. Overall, this would mean a single call to Check from the proxy to the mixer to perform access control and to get routing information. And because we aggressively cache results from Check, the routing response will automatically get cached and reused as appropriate.

We're still finishing up the logic to have adapters producing attributes to return to the proxy. We'll probably have something running here by next week at some point. We have currently no code in the proxy to consumed and act upon returned attributes from the mixer, so that needs to be created.

galo commented 7 years ago

Thanks! I started looking into leveraging the Check adapter to return attributes. I'll take a look at the proxy.