Istio session affinity for multiple hosts (multi-cluster, multi-network)

Question: Can a session affinity to a cluster be implemented using Istio in a multi-cluster, multi-network setup when multiple services are involved?

Condition: The incoming requests are being processed by different services, depending on the URL path, but following requests to any service should remain in the same cluster as the first request (e.g. based on a cookie)

Example:

  • a request comes in at the IngressGateway. The IngressGateway should than decide based (for example) on a cookie, independent of the destination service
    • if the request remains in the same cluster
    • or it is forwarded to the EastWestGateway to be processed in the other cluster (as the initial request landed there)

Things that probably don’t work

We can define a DestinationRule using the ConsistentHashLB to have some session affinity. This is defined per destination host (e.g. ratings.prod.svc.cluster.local) and

The affinity to a particular destination host will be lost when one or more hosts are added/removed from the destination service.

So I take that the value of the cookie depends on which pods are available. That means that for two different destination services different clusters could be selected.

Is my understanding correct? Does Istio offer any support for what we need?