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 an issue in NodeInfo.Clone() #67456

Merged
merged 1 commit into from
Aug 16, 2018

Conversation

Huang-Wei
Copy link
Member

  • usedPorts is a map-in-map struct, add fix to ensure it's deep copied
  • updated unit test

What this PR does / why we need it:

Due to PR "Refactor HostIP predicate algorithm #55910", internal usedPorts data structure was changed from "map[string]bool" to "map[string]map[ProtocolPort]struct{}".

However, it breaks behavior of NodeInfo.Clone(): in the before, one loop for k, v := range usedPorts worked fine because it's a safe assignment, but it's not safe any more for a map-in-map using original code. A similar go playground sample is here: https://play.golang.org/p/puqMN71cmSO.

Which issue(s) this PR fixes:
Fixes #67453 (Might also related with #66568)

Special notes for your reviewer:

Release note:

Fix an issue that pods using hostNetwork keep increasing.

- usedPorts is a map-in-map struct, add fix to ensure it's deep copied
- updated unit test
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 15, 2018
@Huang-Wei
Copy link
Member Author

/sig scheduling
/cc @bsalamat @k82cn @ravisantoshgudimetla @resouer

@duglin
Copy link

duglin commented Aug 15, 2018

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 15, 2018
@duglin
Copy link

duglin commented Aug 15, 2018

/LGTM
assuming tests pass

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 15, 2018
Copy link
Member

@bsalamat bsalamat left a comment

Choose a reason for hiding this comment

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

Great that you caught this issue, @Huang-Wei! Thanks!

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bsalamat, duglin, Huang-Wei

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 15, 2018
@bsalamat
Copy link
Member

This should be cherrypicked to previous releases.

@Huang-Wei
Copy link
Member Author

Thanks @bsalamat . I will create cherrypick PRs once this one get merged.

@Huang-Wei
Copy link
Member Author

/test pull-kubernetes-integration

@Huang-Wei
Copy link
Member Author

/retest

@k82cn
Copy link
Member

k82cn commented Aug 15, 2018

LGTM :)

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 65561, 67109, 67450, 67456, 67402). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 92fc828 into kubernetes:master Aug 16, 2018
@Huang-Wei Huang-Wei deleted the pods-incresing-issue branch August 16, 2018 05:19
k8s-github-robot pushed a commit that referenced this pull request Aug 16, 2018
…456-upstream-release-1.10

Automatic merge from submit-queue.

Automated cherry pick of #67456: fix an issue in NodeInfo.Clone()

Cherry pick of #67456 on release-1.10.

#67456: fix an issue in NodeInfo.Clone()
k8s-github-robot pushed a commit that referenced this pull request Aug 20, 2018
…456-upstream-release-1.11

Automatic merge from submit-queue.

Automated cherry pick of #67456: fix an issue in NodeInfo.Clone()

Cherry pick of #67456 on release-1.11.

#67456: fix an issue in NodeInfo.Clone()
@Huang-Wei Huang-Wei mentioned this pull request Oct 30, 2018
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. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pods with hostNetwork are not scheduled correctly
6 participants