apache / apisix-ingress-controller

APISIX Ingress Controller for Kubernetes
https://apisix.apache.org/
Apache License 2.0
972 stars 337 forks source link

request help: how to translate the nginx weight-based annotation to apisix ingress controller #2199

Open ruiruijianggg opened 3 months ago

ruiruijianggg commented 3 months ago

Issue description

I want to know how to translate the weight-based canary annotation in nginx【nginx.ingress.kubernetes.io/canary-weight】. The apisix ingress controller implements the canary function based on the traffix-split plug-in. Now I can only get the weight of the gray upstream from annotation. And the traffic-split plugin-in needs the id and weight of both the baseline upstream and the gray upstream. How the apisix ingress controller implement canary publishing based annotations?

Environment

pottekkat commented 3 months ago

@ruiruijianggg From the Nginx Ingress Controller docs it seems like the weight you set in the nginx.ingress.kubernetes.io/canary-weight is the the percentage of traffic you want to route to your canary deployment. In APISIX, the you can configure a more granular traffic split where you can specify the ratio of how traffic is to be split between your baseline deployment and canary deployment. So if you want to directly translate, you can translate the percentage to ratio.

nginx.ingress.kubernetes.io/canary-weight: 50 would mean 50% to canary release. In ApisixRoute, this becomes:

apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
  name: canary-release
spec:
  http:
    - name: canary-route
      match:
        paths:
          - /*
      backends:
        - serviceName: baseline-deployment
          servicePort: 8080
          weight: 50
        - serviceName: canary-deployment
          servicePort: 8080
          weight: 50

The weight can also be 1:1 or 2:2 as it would be treated as ratios as opposed to percentages in the Nginx annotation.

github-actions[bot] commented 2 days ago

This issue has been marked as stale due to 90 days of inactivity. It will be closed in 30 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

pottekkat commented 2 days ago

@ruiruijianggg Were you able to configure it?