I have two Istio RouteRules for httpDelay:
apiVersion: config.istio.io/v1alpha2
kind: RouteRule
metadata:
name: foo-delay
spec:
destination:
name: foo-server
precedence: 5
route:
- labels:
serving: "true"
httpFault:
delay:
fixedDelay: 7.000s
percent: 100And for httpReqTimeout:
apiVersion: config.istio.io/v1alpha2
kind: RouteRule
metadata:
name: foo-timeout-default
spec:
destination:
name: foo-server
route:
- labels:
serving: "true"
httpReqTimeout:
simpleTimeout:
timeout: 5s
precedence: 3However, I'm not able to make both of these RouteRules to work together. For this configuration, I have a delay to foo-server but request timeout doesn't work so I receive the data from the foo-server. I have tried to change the httpDelay rule precedence: 2. In this case don't get any delay at all, and I presume that the httpReqTimeout works fine. In both cases I can see that both rules are created:
>istioctl get routerules
NAME KIND NAMESPACE
foo-delay RouteRule.v1alpha2.config.istio.io default
foo-timeout-default RouteRule.v1alpha2.config.istio.io defaultWhy doesn't these two RouteRules work together?
There are two things happening here. RouteRule "precedence" in Istio does not infer merging. So the rule with the highest precedence and matching criteria will match first and all others are ignored by the envoy proxy. Additionally, even if you merge these two rules into one single rule, unfortunately envoy cannot handle this scenario. Envoy is written such that faults apply before any timeout/retry