We’re working towards deploying Istio in our k8s clusters. Our prototype cluster has a virtualservice defined for a service. Requests to the service are being processed correctly.
I’m now trying to augment this virtualservice with alternate routes with header matches. After adding these, I’m finding that all requests are going to the alternate route, even if the header is not set. I can see why this is happening, because we don’t have a “default” route. The original “default” route still used “match” on the uri. I wish there was a way to AND all the match terms, instead of ORing them, but I believe the conventional solution at this point is to set up a “default” route.
This is what the vs def currently looks like:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
annotations: {}
name: fooms-vs-ingress
namespace: com-example
spec:
gateways:
- ingress-gateway
hosts:
- '*'
http:
- match:
- uri:
prefix: /msapi/foo
- headers:
debug-route-riskassessmentms:
exact: myuid-1
route:
- destination:
host: fooms.com-example.svc.cluster.local
port:
number: 80
subset: myuid-1
- match:
- uri:
prefix: /msapi/foo
route:
- destination:
host: fooms.com-example.svc.cluster.local
port:
number: 80
subset: blue
What is the proper solution for ensuring that requests that don’t match the “header” match use the second match block instead of the first one? I still need it to match the uri.