tokers opened a new issue #289:
URL: https://github.com/apache/apisix-ingress-controller/issues/289


   We have a [traffic split 
plugin](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/traffic-split.md)
 in Apache APISIX, but it's not easy to use it in Ingress scenario because 
there are some resource reference relationships like `upstream_id`.
   
   In consideration of the widely use of traffic split in Ingress, Service 
Mesh, I'd like to implement this function into ApisixRoute, as the first class 
feature, rather than using the plugin mechanism. Just like what the 
[TrafficSplit](https://github.com/servicemeshinterface/smi-spec/blob/main/apis/traffic-split/v1alpha4/traffic-split.md)
 resource do in [SMI](https://github.com/servicemeshinterface/smi-spec).
   
   Currently, the ApisixRoute v2alpha1 supports to configure one backend, we 
may extend it as the following:
   
   ```yaml
   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:
          - /status
        weightedBackends:
        - serviceName: httpbin
           servicePort: 80
           weight: 100
        - serviceName: httpbin2
           servicePort: 8080
           weight: 50
   ```
   
   We can add a new field `weightedBackends`, which is exclusive with `backend` 
field, the `weightedBackends` contains a couples of backends, each one 
specifying a Service (name, port) and its weight.
   
   when `weightedBackends` exists, the traffic split plugin will be enabled in 
the ultimate APISIX Route resource (but is invisible from users).
   
   Note since the traffic plugin also supports users to configure match 
conditions but it's not required in ApisixRoute scenario, the match conditions 
are written in `match` field, so the generated plugin config won't have the 
match field.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to