-
Notifications
You must be signed in to change notification settings - Fork 129
Validate agent token for duplicate IP addresses #3673
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3673 +/- ##
==========================================
+ Coverage 87.06% 87.08% +0.01%
==========================================
Files 127 127
Lines 15602 15594 -8
Branches 62 62
==========================================
- Hits 13584 13580 -4
+ Misses 1859 1856 -3
+ Partials 159 158 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Problem: In some environments, Pods could share an IP address (for example when a Job completes and a new Pod grabs that IP). This would cause problems when the nginx data plane Pod would attempt to connect to the control plane. The control plane would try to validate the token provided by the nginx agent, by using the IP address in the request to lookup the associated Pod. If multiple Pods existed with that IP address, the control plane would error out. Solution: Fix the control plane logic to use more criteria when getting the proper Pod to verify the provided token.
LabelSelector: labels.Set(map[string]string{ | ||
controller.AppNameLabel: usernameItems[3], | ||
}).AsSelector(), |
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.
if, in this case, the job has the same labels, does that mean it would still error? is that just an edge case which we shouldn't need to worry about?
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.
We check the Pod phase to ensure that only one pod is running, even if the Job fits this same selector
@sjberman were you able to get in a situation like in the original issue and manually verify it works? |
@bjee19 Not quite, but I confirmed with the user what causes it, and the code avoids that scenario. |
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.
lgtm, nice
Problem: In some environments, Pods could share an IP address (for example when a Job completes and a new Pod grabs that IP). This would cause problems when the nginx data plane Pod would attempt to connect to the control plane. The control plane would try to validate the token provided by the nginx agent, by using the IP address in the request to lookup the associated Pod. If multiple Pods existed with that IP address, the control plane would error out.
Solution: Fix the control plane logic to use more criteria when getting the proper Pod to verify the provided token.
Closes #3657
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.