AlinsRan opened a new pull request, #2472:
URL: https://github.com/apache/apisix-ingress-controller/pull/2472

   <!-- Please answer these questions before submitting a pull request -->
   
   ### Type of change:
   
   <!-- Please delete options that are not relevant. -->
   
   <!-- Select all the options from below that matches the type your PR best -->
   
   - [ ] Bugfix
   - [ ] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   - [ ] Documentation
   - [ ] Refactor
   - [ ] Chore
   - [ ] CI/CD or Tests
   
   ### What this PR does / why we need it:
   
   For the following set of resources, it will only take effect for the last 
resource.
   
   
   
   
   
   ```yaml
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: route-11111
   spec:
     ingressClassName: apisix
     http:
     - name: rule0
       match:
         hosts:
         - httpbin-11111
         paths:
         - /*
       backends:
       - serviceName: httpbin
         servicePort: 80
   ---
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: route-1111
   spec:
     ingressClassName: apisix
     http:
     - name: rule0
       match:
         hosts:
         - httpbin-1111
         paths:
         - /*
       backends:
       - serviceName: httpbin
         servicePort: 80
   ---
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: route-111
   spec:
     ingressClassName: apisix
     http:
     - name: rule0
       match:
         hosts:
         - httpbin-111
         paths:
         - /*
       backends:
       - serviceName: httpbin
         servicePort: 80
   ---
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: route-11
   spec:
     ingressClassName: apisix
     http:
     - name: rule0
       match:
         hosts:
         - httpbin-11
         paths:
         - /*
       backends:
       - serviceName: httpbin
         servicePort: 80
   ---
   
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: route-1
   spec:
     ingressClassName: apisix
     http:
     - name: rule0
       match:
         hosts:
         - httpbin-1
         paths:
         - /*
       backends:
       - serviceName: httpbin
         servicePort: 80
   ```
   
   ```bash
   # expect 200
   curl http://127.0.0.1:9080/get -H "Host: httpbin-1111"
   > 404
   
   # expect 200
   curl http://127.0.0.1:9080/get -H "Host: httpbin-1111"
   > 404
   
   # expect 200
   curl http://127.0.0.1:9080/get -H "Host: httpbin-111"
   > 404
   
   # expect 200
   curl http://127.0.0.1:9080/get -H "Host: httpbin-11"
   > 404
   
   # expect 200
   curl http://127.0.0.1:9080/get -H "Host: httpbin-1"
   > 200
   ```
   
   
   This is due to prefix matching causing cached routes to be deleted.
   
   
https://github.com/apache/apisix-ingress-controller/blob/2b9b787a9397ed9348ccfa9eb8d568acc671f6fd/internal/provider/adc/store.go#L68-L73
   
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   
   ### Pre-submission checklist:
   
   <!--
   Please follow the requirements:
   1. Use Draft if the PR is not ready to be reviewed
   2. Test is required for the feat/fix PR, unless you have a good reason
   3. Doc is required for the feat PR
   4. Use a new commit to resolve review instead of `push -f`
   5. Use "request review" to notify the reviewer once you have resolved the 
review
   -->
   
   - [ ] Did you explain what problem does this PR solve? Or what new features 
have been added?
   - [ ] Have you added corresponding test cases?
   - [ ] Have you modified the corresponding document?
   - [ ] Is this PR backward compatible? **If it is not backward compatible, 
please discuss on the [mailing 
list](https://github.com/apache/apisix-ingress-controller#community) first**
   


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

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to