是否可以在虚拟服务中为路由目的地设置回退?

问题描述

这是我的虚拟服务目前的样子 -

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
Metadata:
  name: example-route
spec:
  hosts:
 - example.com
  http:
 - match:
    - port: 443
    - uri:
        prefix: "/catalog" 
   route:
    - destination:
        host: catalog-server.ns.svc.cluster.local
 - match:
    - port: 443
   route:
    - destination:
        host: general-server.ns.svc.cluster.local

我想要的是在虚拟服务/istio 中为目标主机(catalog-server.ns.svc.cluster.local)设置回退或认主机?

我期待这样的事情

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
Metadata:
  name: example-route
spec:
  hosts:
 - example.com
  http:
 - match:
    - port: 443
    - uri:
        prefix: "/catalog" 
   route:
    - destination:
        host: catalog-server.ns.svc.cluster.local
      fallback:
        host: general-server.ns.svc.cluster.local

 - match:
    - port: 443
   route:
    - destination:
        host: general-server.ns.svc.cluster.local

用例: 当“/catalog”流量大时,我打开一个目录服务器,它与一般服务器相同,但为请求类型专用。 所以当目录服务器启动时,“/catalog”请求必须转发到目录服务器,当关闭时,它必须转发到通用服务器。每次启动或删除目录服务器时,我都无法更新虚拟服务。

解决方法

Istio 确实为 https://istio.io/latest/docs/tasks/traffic-management/circuit-breaking/

中所述的熔断提供了一些支持

但是,afaik 不支持回退。这可能意味着如果主服务关闭,应用程序将不得不调用回退。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...