微服务引擎 CSE-灰度规则设置:设置服务路由策略

时间:2024-08-30 14:51:57

设置服务路由策略

配置项:servicecomb.routeRule,配置内容:

providerA: |
  - precedence: 2
    match:
      headers:
        id:
          exact: '1'
          caseInsensitive: false
    route:
      - weight: 0
        tags:
          group: base
      - weight: 100
        tags:
          group: gray
  - precedence: 1   
    route:     
      - weight: 100       
        tags:         
          group: base     
      - weight: 0       
        tags:         
          group: gray
providerB: |
  - precedence: 2
    match:
      headers:
        id:
          exact: '1'
          caseInsensitive: false
    route:
      - weight: 0
        tags:
          group: base
      - weight: 100
        tags:
          group: gray
  - precedence: 1   
    route:     
      - weight: 100       
        tags:         
          group: base     
      - weight: 0       
        tags:         
          group: gray

服务路由策略设置说明:

  1. 请求头的id参数值精确匹配为1时,consumer的所有请求流量都是从providerA-gray流向providerB-gray。
  2. 请求头的id参数值为其他任意值,consumer的所有请求流量都是从providerA流向providerB。
support.huaweicloud.com/bestpractice-cse/cse_05_0055.html