Skip to content
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

fix(translate) use Ingress-specific regex prefix #2956

Merged
merged 2 commits into from
Sep 23, 2022
Merged

Conversation

rainest
Copy link
Contributor

@rainest rainest commented Sep 21, 2022

What this PR does / why we need it:

Translate between an Ingress-compatible regex prefix and the Kong regex prefix. Allow users to override the default regex prefix using an annotation.

Add tests for regex Ingress paths using the prefix.

By default, Ingress paths beginning with /~ will translate to Kong route paths beginning with ~. This functionality is not version-gated, with the expectation that such paths are uncommon in the wild. For users that do need these paths translated verbatim, overriding the prefix with the konghq.com/regex-prefix allows you to preserve /~-prefixed paths as they are.

Which issue this PR fixes:
Fix #2945

Special notes for your reviewer:

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@rainest rainest temporarily deployed to Configure ci September 21, 2022 22:08 Inactive
@rainest rainest temporarily deployed to Configure ci September 21, 2022 22:42 Inactive
@rainest rainest temporarily deployed to Configure ci September 21, 2022 23:24 Inactive
@rainest rainest marked this pull request as ready for review September 21, 2022 23:58
@rainest rainest requested a review from a team as a code owner September 21, 2022 23:58
@rainest rainest temporarily deployed to Configure ci September 22, 2022 02:10 Inactive
@rainest rainest temporarily deployed to Configure ci September 22, 2022 02:32 Inactive
CHANGELOG.md Show resolved Hide resolved
Copy link
Contributor

@randmonkey randmonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally LGTM, nut some minor discussions on code clearity.

internal/dataplane/parser/translate_ingress.go Outdated Show resolved Hide resolved
@jrsmroz
Copy link
Contributor

jrsmroz commented Sep 22, 2022

Can we add a tests, that overrides the prefix-path, but uses the route with /~ that is not a regex? I didn't find this combination in tests.

Translate between an Ingress-compatible regex prefix and the Kong regex
prefix.

Allow users to override the default regex prefix.

Add tests for regex Ingress paths using the prefix.
@rainest rainest temporarily deployed to Configure ci September 23, 2022 18:06 Inactive
Move non-legacy logic inside maybePrependPrefix.

Add a test for a default prefix path on an Ingress that overrides the
prefix.

Further CHANGELOG updates.
@rainest rainest temporarily deployed to Configure ci September 23, 2022 18:25 Inactive
@rainest rainest temporarily deployed to Configure ci September 23, 2022 18:47 Inactive
@rainest rainest enabled auto-merge (squash) September 23, 2022 18:58
Copy link
Contributor

@jrsmroz jrsmroz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rainest rainest merged commit ac680a3 into main Sep 23, 2022
@rainest rainest deleted the fix/special-prefix branch September 23, 2022 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'~' prefix is not allowed in k8s ingress path
4 participants