ingress-nginx
ingress-nginx copied to clipboard
Fix admission webhook host/path overlap detection not working for multiple rules
What this PR does / why we need it:
The checkOverlap function should check all rules of a new ingress object to make sure it doesn't overlap with any existing ingress objects. This function would exit early before if the first rule passes validation even if it should check all rules. This PR fixes the function to check all rules for overlap before accepting the object.
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] CVE Report (Scanner found CVE and adding report)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation only
Which issue/s this PR fixes
fixes #13161
How Has This Been Tested?
Manually built an image and deployed locally, and the repro case in #13161 now fails validation as expected. Also, the new e2e test passed github CI.
Checklist:
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I've read the CONTRIBUTION guide
- [x] I have added unit and/or e2e tests to cover my changes.
- [x] All new and existing tests passed.