It is said the following on the official documentation about splitting virtual services:
Although the order of evaluation for rules in any given source VirtualService will be retained, the cross-resource order is UNDEFINED. In other words, there is no guaranteed order of evaluation for rules across the fragment configurations, so it will only have predictable behavior if there are no conflicting rules or order dependency between rules across fragments.
There should only be one “catch-all” rule (i.e., a rule that matches any request path or header) in the fragments. All such “catch-all” rules will be moved to the end of the list in the merged configuration, but since they catch all requests, whichever is applied first will essentially override and disable any others.
A VirtualService can only be fragmented this way if it is bound to a gateway. Host merging is not supported in sidecars.
In my opinion, the documentation is lacking some examples. Specifically, what happens regarding hosts wildcards? If I have two virtual services as following:
apiVersion: networking.istio.io/v1beta1 kind: VirtualService metadata: name: musa-test-monolith-additional namespace: default spec: gateways: - default/test-monolith hosts: - musa.mystaging.test.com http: - match: - uri: prefix: / retries: attempts: 0 route: - destination: host: frontend-test-nextjs port: number: 80 timeout: 30s --- apiVersion: networking.istio.io/v1beta1 kind: VirtualService metadata: name: test-monolith-additional namespace: default spec: gateways: - default/test-monolith hosts: - rails.staging.test.com - '*.mystaging.test.com' http: - match: - uri: prefix: / retries: attempts: 0 route: - destination: host: test-monolith port: number: 80 timeout: 30s
My question is, taking into account the documentation and these two services previously referred, is it guaranteed that when I visit
musa.mystaging.test.com the traffic will always go to the host
frontend-test-nextjs? I mean, when is there any “collision” between
musa.mystaging.test.com or will it always fallback to
*.mystaging.test.com if it doesn’t match
Istio version - 1.6
EKS - 1.16