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 polarity of NodePort logic to avoid leaked ports #43259

Merged

Conversation

thockin
Copy link
Member

@thockin thockin commented Mar 17, 2017

The result of this was that an update to a Service would release the
NodePort temporarily (the repair loop would fix it in a minute). During
that window, another Service could get allocated that Port.

Fixes #43233

The result of this was that an update to a Service would release the
NodePort temporarily (the repair loop would fix it in a minute).  During
that window, another Service could get allocated that Port.
@thockin thockin added this to the v1.6 milestone Mar 17, 2017
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 17, 2017
@k8s-github-robot k8s-github-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. release-note-label-needed labels Mar 17, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@thockin thockin added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Mar 17, 2017
@thockin
Copy link
Member Author

thockin commented Mar 17, 2017

@k8s-bot verify test this

@thockin
Copy link
Member Author

thockin commented Mar 17, 2017

@k8s-bot gci gce e2e test this

anhowe added a commit to anhowe/kubernetes that referenced this pull request Mar 17, 2017
@thockin
Copy link
Member Author

thockin commented Mar 17, 2017

@k8s-bot gci gce e2e test this

@thockin
Copy link
Member Author

thockin commented Mar 17, 2017

User confirms this fixed the problem. Once LGTM I will offer a 1.5.x patch

@brendandburns
Copy link
Contributor

/lgtm

Thanks for the quick fix @thockin

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 17, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, thockin

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@smarterclayton
Copy link
Contributor

Any way to simulate this race from a unit test?

@thockin
Copy link
Member Author

thockin commented Mar 17, 2017

yeah, I need to get a test ready for this, but I didn't want to block getting this up.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit c119c25 into kubernetes:master Mar 17, 2017
@@ -436,7 +436,7 @@ func (rs *REST) Update(ctx genericapirequest.Context, name string, objInfo rest.
// The comparison loops are O(N^2), but we don't expect N to be huge
// (there's a hard-limit at 2^16, because they're ports; and even 4 ports would be a lot)
for _, oldNodePort := range oldNodePorts {
if !contains(newNodePorts, oldNodePort) {
if contains(newNodePorts, oldNodePort) {
Copy link
Member

Choose a reason for hiding this comment

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

Gah - I should stop doing double-negatives :-(

@thockin thockin modified the milestones: v1.5, v1.6 Mar 17, 2017
@colemickens
Copy link
Contributor

@thockin do we not need to cherry-pick this into release-1.6 as well?

@thockin
Copy link
Member Author

thockin commented Mar 17, 2017 via email

@colemickens
Copy link
Contributor

Let me know... I can go ahead and generate and send the cherry-pick for 1.6... it looks like you got it into 1.5 already.

@thockin
Copy link
Member Author

thockin commented Mar 20, 2017 via email

@thockin
Copy link
Member Author

thockin commented Mar 20, 2017 via email

@colemickens
Copy link
Contributor

I don't really understand how, but your commit is in release-1.6...

I manually checked the commit history and looked at the current state of the code...

Sorry for the noise, I guess it's all already taken care of.

@ethernetdan
Copy link
Contributor

@thockin @colemickens we are still fastforwarding changes into release-1.6 from master. Will stop after rc.1 comes out or the release, whichever comes first.

@thockin
Copy link
Member Author

thockin commented Mar 20, 2017 via email

@ethernetdan
Copy link
Contributor

ethernetdan commented Mar 20, 2017

It is but it's implemented as a blacklist. We probably want to change that 😃

@thockin
Copy link
Member Author

thockin commented Mar 20, 2017 via email

@thockin thockin added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Mar 22, 2017
@thockin thockin changed the title Fix polarity of a test in NodePort allocation Fix polarity of NodePort logic to avoid leaked ports Mar 22, 2017
k8s-github-robot pushed a commit that referenced this pull request Apr 4, 2017
…9-upstream-release-1.5

Automatic merge from submit-queue

Automated cherry pick of #43259

Cherry pick of #43259 on release-1.5.

#43259: Fix polarity of a test in NodePort allocation
@k8s-cherrypick-bot
Copy link

Commit found in the "release-1.5" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nodeport assigned to two services on 3 Master HA Cluster
10 participants