Can istio prevent request infinite loop in the circuit break policy?

Viewed 38

How can I configure my circuit breaker to block circular requests between services?

Example:

serviceA.endpoin1 -> serviceB.endpoin2 -> serviceC.endpoin3 -> serviceA.endpoin1

In this scenario serviceC will trigger the serviceA and will enter in a infinitive loop. Note that the endpoint serviceC.endpoint3 will trigger the initial endpoint serviceA.endpoint1. If the serviceC is calling another endpoint of serviceA, that will not be a problem (or will?).

1 Answers

I'm not aware of such function to exist.

What comes to mind is to use HTTPMatchRequest, preventing requests with particular header to be directed to serviceA.endpoin1.
For example applying VirtualService to serviceA.endpoin1, to redirect all requests with header x-original-source: serviceA.endpoin1 to another endpoint.

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: <name>
spec:
  hosts:
  - "*"
  http:
  - match:
    - headers:
        x-original-source:
          exact: serviceA.endpoin1
    route:
    - destination:
        host: <some other endpoint different than serviceA.endpoin1>
Related