Skip to content

feat: add basic sticky-sessions support #7466

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

Merged
merged 18 commits into from
Jun 11, 2025
Merged

feat: add basic sticky-sessions support #7466

merged 18 commits into from
Jun 11, 2025

Conversation

tao12345666333
Copy link
Member

What this PR does / why we need it:

Which issue this PR fixes:

part of #7418

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

@tao12345666333 tao12345666333 self-assigned this May 30, 2025
Copy link

codecov bot commented May 30, 2025

Codecov Report

Attention: Patch coverage is 95.91837% with 2 lines in your changes missing coverage. Please review.

Project coverage is 77.3%. Comparing base (6ecb0c5) to head (4017786).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ternal/dataplane/translator/translate_upstreams.go 94.7% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #7466     +/-   ##
=======================================
- Coverage   77.3%   77.3%   -0.1%     
=======================================
  Files        220     220             
  Lines      25372   25407     +35     
=======================================
+ Hits       19623   19643     +20     
- Misses      4747    4767     +20     
+ Partials    1002     997      -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tao12345666333 tao12345666333 force-pushed the feat-sticky-sessions branch 2 times, most recently from 76311b9 to 0be0414 Compare June 4, 2025 05:35
@tao12345666333 tao12345666333 linked an issue Jun 4, 2025 that may be closed by this pull request
5 tasks
@tao12345666333 tao12345666333 marked this pull request as ready for review June 5, 2025 07:59
@tao12345666333 tao12345666333 requested a review from a team as a code owner June 5, 2025 07:59
Comment on lines 78 to 84
algorithm: consistent-hashing
slots: 100

# Configure session-based sticky routing using cookies
hashOn:
cookie: session-id # Name of the session cookie
cookiePath: / # Path for the session cookie
Copy link
Member Author

@tao12345666333 tao12345666333 Jun 5, 2025

Choose a reason for hiding this comment

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

This section is currently a placeholder, I need to make modifications based on the specific implementation of the Gateway.

Copy link
Member

Choose a reason for hiding this comment

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

Does this still require more work or can we move forward with currently set value here?

Copy link
Member Author

@tao12345666333 tao12345666333 Jun 12, 2025

Choose a reason for hiding this comment

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

@pmalek In the current gateway implementation, the algorithm name is set to "sticky-sessions"

xref: https://github.com/Kong/kong-ee/pull/12524

Copy link
Member

Choose a reason for hiding this comment

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

Ok, can you be more specific what does that mean for us? What work is still required? What changes still need (if any) to be done?

Copy link
Member Author

Choose a reason for hiding this comment

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

This means we need to change the manifest according to the implementation in the gateway. I think the other parts do not need to be adjusted.

Copy link
Member

Choose a reason for hiding this comment

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

according to the implementation in the gateway

That means specifically what exactly? We need to change the hashOn settings? We need to change the session-script ConfigMap? I think that this needs to be written down somewhere.

I've reopened #7418 to cover this work (as I understand there is still something to be done for this feature). LMYK if that works for you.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess I can submit a PR when I'm available (in a few hours)

Copy link

@justindavies justindavies Jun 12, 2025

Choose a reason for hiding this comment

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

Was this update made ? OR is it simply I need to update the alorithm in the manofest to be sticky-sessions ?

Copy link
Member

Choose a reason for hiding this comment

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

The updated manifest can be found in #7495

Signed-off-by: Jintao Zhang <[email protected]>
@tao12345666333 tao12345666333 force-pushed the feat-sticky-sessions branch from f54f96a to 5e1b0c3 Compare June 7, 2025 18:28
Copy link
Contributor

@sandromodarelli sandromodarelli left a comment

Choose a reason for hiding this comment

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

lgtm

@pmalek pmalek force-pushed the feat-sticky-sessions branch from fae08a9 to 502f01a Compare June 11, 2025 08:43
@pmalek pmalek added this pull request to the merge queue Jun 11, 2025
Merged via the queue into main with commit 65914ce Jun 11, 2025
42 checks passed
@pmalek pmalek deleted the feat-sticky-sessions branch June 11, 2025 20:55
@pmalek pmalek mentioned this pull request Jun 12, 2025
5 tasks
@pmalek pmalek added this to the KIC v3.5.x milestone Jun 12, 2025
Copy link
Member

Choose a reason for hiding this comment

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

I'm sorry it's just now that I realized this but I believe we should remove this test:

  • This test shouldn't really be placed in this directory.

    This is not an integration test, it doesn't use the cluster in any way of nor it interacts with it using any of the clients that we typically use in integration tests.

  • Secondly and more importantly, this doesn't really test anything. Note that the only interaction that this test has with KIC's packages is util.Endpoint which it creates in the test body itself, not through any of the functions or types added in this PR.

Having said that I believe we should remove this test and ideally add a proper one that verifies the added functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add sticky sessions support
5 participants