I have two namespaces.
application:
Virtual Service C -> B
gateway: mesh
host: serviceC.external.svc.cluster.local
destination: serviceB.application.svc.cluster.local
exportTo: . (same namespace)
external:
Virtual Service C -> C
gateway: mesh
host: serviceC.external.svc.cluster.local
destination: serviceC.external.svc.cluster.local
exportTo: * (all namespaces)
Question: Which Virtual Service handles request form serviceA to serviceC.external.svc.cluster.local? Is there any priority?
Istio says “A VirtualService can only be fragmented this way if it is bound to a gateway. Host merging is not supported in sidecars.”
I’ve tried to reproduce this situation and Virtual Service C -> B handles request and routs it to ServiceB.
If I understand you correctly there are some documented materials you should check out:
Multiple rules for a given destination in a configuration file are evaluated in the order they appear. The first rule on the list has the highest priority.
Multiple route rules could be applied to the same destination. The order of evaluation of rules corresponding to a given destination, when there is more than one, can be specified by setting the precedence field of the rule.
The precedence field is an optional integer value, 0 by default. Rules with higher precedence values are evaluated first. If there is more than one rule with the same precedence value the order of evaluation is undefined.
Please let me know if that helped.