we can do istio multicluster failover using outlier detection with shared control plane with https://istio.io/latest/docs/setup/install/multicluster/shared/, so we have the exactly same service running in two clusters, if one fails, it will switch to the healthy automatically, that works perfectly. recently, we have a new request which is to do the same failover in the same cluster cross namespaces with the same service. such as my-service.ns1 and my-service.ns2, from the doc we can do traffic shifting with below code, not sure if there's way to do the failover, thanks.
kind: VirtualService
metadata:
name: helloworld
spec:
hosts:
- "*"
gateways:
- helloworld-gateway
http:
- match:
- uri:
exact: /hello
route:
- destination:
host: helloworld.default.svc.cluster.local
port:
number: 5000
weight: 50
- destination:
host: helloworld.test.svc.cluster.local
port:
number: 5000
weight: 50