Fault and Retry on VirtualService

We have this VS for test on bookinfo sample:

cat <<EOF | kubectl apply -f -
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: ratings
spec:
  hosts:
  - ratings
  http:
  - fault:
      abort:
        percent: 50
        httpStatus: 503
    retries:
      attempts: 10
      perTryTimeout: 0.1s
   route:
    - destination:
        host: ratings
        subset: v1
EOF

Expected result was that 50% of request would fail and then get retried, which should result in success. However, we are getting 50%, 503 and another 50% is working fine.

Looking around, we found this https://github.com/istio/istio/issues/7231, which mentions
“The fault-injection filters are included before any others, including the router filter. The router filter is what controls retries.”

Is it that in case of fault type “abort” envoy/istio-proxy would return 503 without routing to underlying service/container; but for fault type delay, it would wait and then do routing to underlying service/container?

1 Like