-
Notifications
You must be signed in to change notification settings - Fork 590
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: panic in consumer sort func #1658
Conversation
Codecov Report
@@ Coverage Diff @@
## next #1658 +/- ##
==========================================
- Coverage 62.11% 61.96% -0.15%
==========================================
Files 83 83
Lines 7319 7330 +11
==========================================
- Hits 4546 4542 -4
- Misses 2440 2454 +14
- Partials 333 334 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Does this indeed prevent all panics when submitting a no-username consumer? IIRC the deck code further down also panicked when we gave it one, so fixing the sort mechanism will just result in a panic at a different point in the code. Instead, we probably want something like what we do for credentials missing required fields: if we know they will break later, we just log that they're invalid and don't add them to the list. That's ideally accompanied by an admission controller rule to reject them in the client, since logging alone isn't the most obvious UX. If we do proceed with something like Kong/deck#246 eventually we will still want the sort in the controller to work properly, so a sort fix will future proof for that even if it's a no-op if we just drop no-username consumers for the time being. However, it should probably concatenate Username+CustomID rather than have a blanket behavior for any no-username consumer: you can have multiple no-username consumers with distinct custom IDs, and those consumers should sort consistently. |
Pull request was converted to draft
Yep you were right @rainest: my first attempt here was assuming that the consumer would be handled gracefully at the Check out this new patch instead 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this would include an admission controller rule also, but eh, probably still worth avoiding the panic even without.
There's one remaining change that should probably go in; I'm pretty sure the IDs here aren't ever of use.
Co-authored-by: Travis Raines <traines@konghq.com>
* fix: panic in deckgen with nil consumer username * docs: update CHANGELOG.md
What this PR does / why we need it:
Small fix to prevent a panic when an empty username is given for a
KongConsumer
.Which issue this PR fixes
Fixes #550
PR Readiness Checklist:
CHANGELOG.md
release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR