Sort wildcard domain ingress routes after non-wildcard routes#287
Open
joelcox22 wants to merge 6 commits intoSTRRL:masterfrom
Open
Sort wildcard domain ingress routes after non-wildcard routes#287joelcox22 wants to merge 6 commits intoSTRRL:masterfrom
joelcox22 wants to merge 6 commits intoSTRRL:masterfrom
Conversation
… as fallbacks Co-authored-by: joelcox22 <1089216+joelcox22@users.noreply.github.com>
Co-authored-by: joelcox22 <1089216+joelcox22@users.noreply.github.com>
Co-authored-by: joelcox22 <1089216+joelcox22@users.noreply.github.com>
Rename `compareIngressRules` to `sortIngressRules` and add single-char subdomain test case
Author
|
Updated sample cloudflare-tunnel-ingress-controller:
image:
repository: ghcr.io/joelcox22/cloudflare-tunnel-ingress-controller
tag: master-43cf4dd-amd64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I had a use-case where I wanted an ingress rule using a wildcard domain to act as a fallback when a more explicit rule did not exist, however with the sort logic of shortest hostnames first, the wildcard domain name was always taking priority even when a more specific domain name without a wildcard existed in a separate ingress route.
This change makes wildcard domains (e.g.
*.example.com) be sorted after, and therefore take lower priority than non-wildcard domains (test.example.com), which seems to be a more sensible default behaviour to me.If you'd like to test this, you can use the following helm values for now:
Then deploy an ingress route with a wildcard, and you will see it's sorted in cloudflare connector application routes below the non-wildcard routes, where without this change, it ended up at the top of the list due to the hostname being shorter than the other routes that had more explicit domain names.
Note: these code changes and tests are generated by AI, but have been reviewed and tested by a human 😄