This is a good idea.

agree +1


On Thu, Mar 18, 2021 at 11:40 AM Chao Zhang <[email protected]> wrote:

> Hi, there
>
> I'm devoting myself to implement the traffic split feature in APISIX
> Ingress Controller, which relies on the traffic split
> (http://apisix.apache.org/docs/apisix/plugins/traffic-split) plugin in
> APISIX.
>
> Considering the traffic split plugin uses some reference relationship
> like "upstream_id", which is obscure if we just use it in the
> ApisixRoute resource. So here I propose that we should support traffic
> split as the first-class feature in ApisixRoute, and hide the
> reference relationship of the underlying traffic split plugin. Just
> let users keep concerned on the Kubernetes Service (as the backend).
>
> The traffic split should at least support two functions, the canary
> release and weight-based traffic shifting.
>
> apiVersion: apisix.apache.org/v2alpha1
> kind: ApisixRoute
> metadata:
>   name: httpbin-route
> spec:
>   http:
>   - name: rule1
>     match:
>       hosts:
>       - httpbin.com
>       paths:
>       - /ip
>     backend:
>       serviceName: httpbin
>       servicePort: 80
>   - name: rule2
>      match:
>        hosts:
>        - httpbin.com
>        paths:
>        - /ip
>        nginxVars:
>          subject: http_user_agent
>          op: Equal
>          value: Mozilla
>      backend:
>         serviceName: httpbin-2
>         servicePort: 80
>
> The above example will proxy traffic whose User-Agent header is
> Mozilla to service httpbin-2; Others will be routed to service
> httpbin.
>
> apiVersion: apisix.apache.org/v2alpha1
> kind: ApisixRoute
> metadata:
>   name: httpbin-route
> spec:
>   http:
>   - name: rule1
>      match:
>        hosts:
>        - httpbin.com
>        paths:
>        - /status
>      backends:
>      - serviceName: httpbin
>         servicePort: 80
>         weight: 100
>      - serviceName: httpbin2
>         servicePort: 8080
>         weight: 50
>
> The above example implements a 2:1 traffic shifting between httpbin
> service and httpbin-2 service.
>
> So here we should extend a new field named "backends" in ApisixRoute,
> which is an array, element there contains serviceName, servicePort and
> weight. Also, the obsolete "backend" field in ApisixRoute actually can
> be deprecated, since it can be replaced by the backends field with one
> element.
>
> Best Regards
> Chao Zhang
> https://github.com/tokers
>


-- 

*MembPhis*
My GitHub: https://github.com/membphis
Apache APISIX: https://github.com/apache/apisix

Reply via email to