Skip to content

Latest commit

 

History

History
55 lines (49 loc) · 1.41 KB

canary-release.md

File metadata and controls

55 lines (49 loc) · 1.41 KB

支持灰度发布

说明

BFE-Ingress-controller支持通过配置Annotation,实现基于Header/Cookie的灰度发布功能。

配置示例

  • 初始的ingress配置如下,请求转发到服务service
kind: Ingress
apiVersion: networking.k8s.io/v1beta1
metadata:
  name: "original"
  namespace: production

spec:
  rules:
    - host: example.net
      http:
        paths:
          - path: /bar
            pathType: Exact
            backend:
              serviceName: service
              servicePort: 80
  • 做灰度发布,对特定请求,转发到新的服务service2
  • 为实现上述目的,创建一个新的ingress,在annotations中包含特定请求的header或cookie的信息。
kind: Ingress
apiVersion: networking.k8s.io/v1beta1
metadata:
  name: "greyscale"
  namespace: production
  annotations:
    bfe.ingress.kubernetes.io/router.cookie: "key: value"
    bfe.ingress.kubernetes.io/router.header: "Key: Value"

spec:
  rules:
    - host: example.net
      http:
        paths:
          - path: /bar
            pathType: Exact
            backend:
              serviceName: service2
              servicePort: 80
  • 基于上面的配置,BFE对
  1. 满足 host == example.net && path == /bar && cookie[key] == value && Header[Key] == Value, 则转发到service-new集群
  2. 仅满足 host == example.net && path == /bar, 仍转发到service集群