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


   ### Issue description
   Apply ApisixRoute one by one cause dirty configuration
   step 1: 
   ```yaml
   apiVersion: apisix.apache.org/v2alpha1
   kind: ApisixRoute
   metadata:
     name: httpbin-route
     namespace: xxx
   spec:
     http:
     - name: rule1
       match:
         hosts:
         - httpbin.com
         paths:
         - /ip
       backends:
       - serviceName: httpbin-service-e2e-test
         servicePort: 80
         weight: 50
       - serviceName: httpbin-service-e2e-test-v2
         servicePort: 80
         weight: 100
   ```
   The route in APISIX like this:
   ```shell
   
{"action":"get","node":{"nodes":[{"modifiedIndex":142,"value":{"priority":0,"status":1,"hosts":["httpbin.com"],"id":"3fc92fca","create_time":1617946799,"update_time":1617946799,"name":"xxx_httpbin-route_rule1","desc":"xxx_httpbin-route_rule1","uris":["\/ip"],"upstream_id":"d678a7ac"},"createdIndex":142,"key":"\/apisix\/routes\/3fc92fca"}],"key":"\/apisix\/routes","dir":true},"count":"2"}
   ```
   
   step 2:
   ```yaml
   kubectl apply -f - <<EOF
   apiVersion: apisix.apache.org/v2alpha1
   kind: ApisixRoute
   metadata:
     name: httpbin-route
     namespace: xxx
   spec:
     http:
     - name: rule1
       priority: 1
       match:
         hosts:
         - httpbin.com
         paths:
         - /ip
       backend:
         serviceName: httpbin-service-e2e-test
         servicePort: 80
     - name: rule2
       priority: 2
       match:
         hosts:
         - httpbin.com
         paths:
         - /ip
         exprs:
         - subject:
             scope: Cookie
             name: X-Foo
           op: Equal
           value: v2
       backend:
         serviceName: httpbin-service-e2e-test-v2
         servicePort: 80
   EOF
   ```
   
   The route in APISIX like this, the plugin `traffic-split`  should be removed.
   
   ```shell
   
{"action":"get","node":{"nodes":[{"modifiedIndex":144,"value":{"priority":0,"status":1,"plugins":{"traffic-split":{"rules":[{"weighted_upstreams":[{"weight":100,"upstream_id":"cd3dc953"},{"weight":50}],"match":[{"vars":[["server_port",">",0]]}]}]}},"id":"3fc92fca","create_time":1617946799,"update_time":1617946924,"name":"xxx_httpbin-route_rule1","hosts":["httpbin.com"],"uris":["\/ip"],"desc":"xxx_httpbin-route_rule1","upstream_id":"d678a7ac"},"createdIndex":142,"key":"\/apisix\/routes\/3fc92fca"}],"key":"\/apisix\/routes","dir":true},"count":"2"}
   ```
   
   


-- 
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