-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 3.x regex prefix for HTTPRoute #2873
Closed
Closed
Conversation
This file contains 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
rainest
added
ci/run-nightly
Run nightly Kong image integration tests
and removed
ci/run-nightly
Run nightly Kong image integration tests
labels
Aug 25, 2022
rainest
added
ci/run-nightly
Run nightly Kong image integration tests
and removed
ci/run-nightly
Run nightly Kong image integration tests
labels
Aug 25, 2022
randmonkey
added
ci/run-nightly
Run nightly Kong image integration tests
and removed
ci/run-nightly
Run nightly Kong image integration tests
labels
Aug 26, 2022
randmonkey
added
ci/run-nightly
Run nightly Kong image integration tests
and removed
ci/run-nightly
Run nightly Kong image integration tests
labels
Aug 26, 2022
3 tasks
I think the cause is Kong/kong#9027, not 9022 (wrong link in the description?) |
rainest
force-pushed
the
fix/3x-regex
branch
from
September 1, 2022 00:53
ede4824
to
ae304d4
Compare
rainest
force-pushed
the
fix/3x-regex
branch
from
September 1, 2022 01:47
ae304d4
to
c9b7eb6
Compare
rainest
added
ci/run-nightly
Run nightly Kong image integration tests
and removed
ci/run-nightly
Run nightly Kong image integration tests
labels
Sep 1, 2022
Minor formatting and spelling fixes. Change cleanIngress to panic instead of error. The error condition was always author error, and not requiring error handling makes it simpler to use in tests. Rename cleanIngress to addIngressToCleaner to better reflect that it's queueing the clean, not immediately cleaning (and should not be deferred as such). Move default IngressClass testing to an E2E test. Using a default IngressClass interferes with other tests that check if removing class information from a resource removes it from configuration. The controller ingress class is set at startup and integration tests cannot use an alternate IngressClass. Remove a spammy helper log in the E2E Kong deployer. Diagnostic dumps will capture the Deployment state if it is the cause of a test failure.
Closed in favor of #2883 to discard the mountain of force push/test/add label events. Ask me if you want the original branch with separated (if not particularly well-organized) commits. |
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.
What this PR does / why we need it:
Kong/kong#9022 requires that regular expression paths in Kong routes include a
~
prefix. If we receive an HTTPRoute with a regular expression path (whose canonical Gateway API form is the regex as-is, with no prefix) or some other path type that we convert into a regex (for example, exact match), prepend the prefix.Which issue this PR fixes:
This addresses the error @randmonkey found in the 3.0 test logs:
Special notes for your reviewer:
HTTPRoutes have a pretty clear path to handling this: they have a designated regular expression match type, and its canonical form is a regex without our special prefix. If we're using 3.x and we have a regex match, we prepend our prefix when creating the Kong route path.
Ingress is a bit less clear. There's no dedicated regex path type, just ImplementationSpecific. We could read that as requiring that you do provide the path in the exact form the Implementation expects, i.e. that you need to prepend the
~
yourself, but that's not obvious and presents an upgrade path nightmare. If we prepend it for you, it'll break configuration for anyone that reads Gateway docs and does prepend it themselves.Checking to see if the prefix is present and adding it if not does seem fine though. Regular expressions without the prefix but with
~
as their first actual match character will not work, but these shouldn't occur since that's not a reserved character and should be vanishingly uncommon given that paths usually begin with/
(apparently paths that do not are valid per thepath-rootless
in https://www.rfc-editor.org/rfc/rfc3986#section-3.3, but I don't think those are relevant to HTTP at least). Worst case if you need a regex that begins with~
you can write your own~~
to provide both that and the prefix.Lastly, although we do not know if ImplementationSpecific paths are regexes or not, using the old Kong heuristic seems a valid approach. AFAICT this was a performance optimization on the gateway's side, not something discarded because it wasn't working.
PR Readiness Checklist:
Complete these before marking the PR as
ready to review
:CHANGELOG.md
release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR