Spring Cloud Gateway灰度发布(预发/金丝雀)

SCG中支持简单的灰度功能,可以根据配置分配流量。

配置

关键配置项目:- Weight={group}, {weigth}

  • application:需要分流的组名
  • weigth:流量百分比,最大值100.
spring:
  application:
    name: fw-gateway
  cloud:
    gateway:
      routes:
      - id: r_hi
        uri: lb://hi
        predicates:
        - Path=/hi
        #hi_test的流量权重
        - Weight=hi_test, 99
      - id: r_hi_t
        uri: lb://hi-new
        predicates:
        - Path=/hi
        #hi_test的流量权重
        - Weight=hi_test, 1

WeightRoutePredicateFactory:分流源码

你可能感兴趣的:(网关,测试,SpringCloud,gateway,灰度发布,Weight,金丝雀)