-
Notifications
You must be signed in to change notification settings - Fork 143
Add ip_hash based session affinity support for NGINX OSS
#4257
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
salonichf5
merged 4 commits into
feat/session-persistence
from
feat/oss-nginx-session-persistence
Nov 13, 2025
Merged
Add ip_hash based session affinity support for NGINX OSS
#4257
salonichf5
merged 4 commits into
feat/session-persistence
from
feat/oss-nginx-session-persistence
Nov 13, 2025
Conversation
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
salonichf5
commented
Nov 12, 2025
internal/controller/nginx/config/policies/upstreamsettings/validator.go
Outdated
Show resolved
Hide resolved
ip_hash based session affinity support for NGINX OSSip_hash based session affinity support for NGINX OSS
ff3ad8e to
698f6ee
Compare
ip_hash based session affinity support for NGINX OSSip_hash based session affinity support for NGINX OSS
sjberman
reviewed
Nov 12, 2025
sjberman
reviewed
Nov 12, 2025
sjberman
approved these changes
Nov 12, 2025
bjee19
approved these changes
Nov 12, 2025
Contributor
bjee19
left a comment
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.
nice
2d2539b to
7f1b7c3
Compare
5403bf5 to
03c61d2
Compare
salonichf5
added a commit
that referenced
this pull request
Nov 18, 2025
salonichf5
added a commit
that referenced
this pull request
Nov 21, 2025
salonichf5
added a commit
that referenced
this pull request
Nov 24, 2025
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.
Proposed changes
Write a clear and concise description that helps reviewers understand the purpose and impact of your changes. Use the
following format:
Problem: Users want to be able to specify ip_hash load balancing for upstreams
Solution: Add support for session affinity using
ip_hashdirective in upstreamsTesting: Manual testing
Scenarios covered in this PR
Create an UpstreamSettingsPolicy with an unsupported method:
Two policies targeting the same Service (tea) with different methods:
Merging behaviour
generated config
Working scenarios
Applying
ip_hashload balancing only toteaservice using Upstream settings policy, coffee should have default lb which israndom two least_connGenerated config.
Now sending request to
teaapplication:All requests get pinned to one backend IP (session affinity)
Now lets see what happens when we do the same for
coffeeapplicationsNote: I tried running curls from K8s pod to send a different IP address to show cases backend selection changes but
ip_hashuses my system IP($remote_addr) which was the same. I'll try more creative ways to do that today But could definitely distinguish between an upstream with ip_hash showcasing stickiness and a regular upstream.Tested with secure-app with backend TLS Policy
Please focus on (optional): If you any specific areas where you would like reviewers to focus their attention or provide
specific feedback, add them here.
Closes #4230
Checklist
Before creating a PR, run through this checklist and mark each as complete.
Release notes
If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.