Failure injection for specific routes in a virtual service?

I setup the BookInfo traffic shaping demo and I have it splitting traffic between my two versions v1 and potato.

My goal is to make 50% of the traffic sent to “v1” fail while letting 100% of traffic sent to “potato” to succeed.

My virtual service for traffic shaping looks like this:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:

  • route:
    • destination:
      host: reviews
      subset: v1
      weight: 50
    • destination:
      host: reviews
      subset: potato
      weight: 50

Then, when I try to add fault injection, it looks like this:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:

  • route:
    • destination:
      host: reviews
      subset: v1
      weight: 50
      fault:
      abort:
      httpStatus: 500
      percent: 50
    • destination:
      host: reviews
      subset: potato
      weight: 50

My problem is that when I apply this policy, 50% of all traffic sent to reviews is hitting the abort clause and then the other 50% of the traffic is being distributed evenly between “v1” and “potato”.

Is there a method I am missing or is it not possible to run the test I described above?

pls try this:

  • destination:
    host: reviews
    subset: v1
    weight: 50
    fault:
    abort:
    httpStatus: 500
    percent: 100

Hi, thank you for your reply.

That’s kind of similar to what my configuration is at the moment:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:

  • reviews
    http:
  • match:
    fault:
    abort:
    percentage:
    value: 50.0
    httpStatus: 500
    route:
    • destination:
      host: reviews
      subset: v1
  • route:
    • destination:
      host: ratings
      subset: v1
      weight: 50
  • route:
    • destination:
      host: ratings
      subset: potato
      weight: 50

With this configuration, 50% of all traffic to the reviews page is failing when I really want 50% of the traffic to v1 to fail and 100% of the traffic to potato to succeed. As you can see from the image, no traffic is being routed to potato so I feel like there is something I am missing but I am struggling to find examples that demonstrate this particular pattern

An update here, my yaml before was wrong, but I just changed it to your example and now, curiously, none of my requests are failing. This is my yaml and the results I am seeing:

image

which results in no traffic failing