If I understand well your use case, you would like to redirect the request to a specific version depending on an attribute set in the request. You shouldn’t (and you couldn’t) configure dynamically the destination weight at runtime. Instead, Istio support traffic routing depending on http headers:
Let’s assume that you have a service with two versions: v1 and v2 and you have a HTTP header called ‘user-type’ that can have ‘internal’ or ‘external’ value.
You would like to redirect internal users to new version v2. Here is how you should process:
First, you need to define the destination rule:
- name: v1
- name: v2
And then apply the VirtualService telling to Istio that each HTTP request with a header ‘user-type’ equal to ‘internal’ should be redirected to v2 :
More documentation can be find at: