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 UpdateSnapshot when Node is partially removed #95130

Merged
merged 1 commit into from Sep 29, 2020

Conversation

alculquicondor
Copy link
Member

@alculquicondor alculquicondor commented Sep 28, 2020

What type of PR is this?

/kind bug

What this PR does / why we need it:

Fix Snapshot update when a Node is deleted before its Pods.

Which issue(s) this PR fixes:

Fixes #95124

Special notes for your reviewer:

This is an old bug that was reintroduced when #93938 reverted some behavior

Does this PR introduce a user-facing change?:

Fix a regression in 1.19 in scheduler cache snapshot when a Node is deleted before its Pods

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Sep 28, 2020
@alculquicondor
Copy link
Member Author

/priority critical-urgent

/assign @Huang-Wei

Sorry I missed this in the previous PR :(
We need to get this cherry picked down to 1.18

@k8s-ci-robot k8s-ci-robot added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 28, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor

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 Sep 28, 2020
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 28, 2020
@@ -256,7 +256,7 @@ func (cache *schedulerCache) UpdateSnapshot(nodeSnapshot *Snapshot) error {
nodeSnapshot.generation = cache.headNode.info.Generation
}

if len(nodeSnapshot.nodeInfoMap) > len(cache.nodes) {
if len(nodeSnapshot.nodeInfoMap) > cache.nodeTree.numNodes {
Copy link
Member

Choose a reason for hiding this comment

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

can you add a comment explaining that deleted nodes get removed from the tree but are kept in the cache until the pods are deleted, and hence here we check against the number of nodes in the tree not the cache.

Copy link
Member

Choose a reason for hiding this comment

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

also, document that the snapshot (both map and lists) only include nodes that are not deleted as of the time the snapshot was taken, and so nodeinfo.Node() is guaranteed not to be nil.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. I amended.

Change-Id: I5b459e9ea67020183c87d1ce0a2380efb8cc3e05
@ahg-g
Copy link
Member

ahg-g commented Sep 28, 2020

/hold
/lgtm

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 28, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 28, 2020
@Huang-Wei
Copy link
Member

Thanks @alculquicondor !

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 28, 2020
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit 3a987d5 into kubernetes:master Sep 29, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.20 milestone Sep 29, 2020
k8s-ci-robot added a commit that referenced this pull request Oct 7, 2020
…f-#95130-upstream-release-1.18

Automated cherry pick of #95130: Fix UpdateSnapshot when Node is partially removed
k8s-ci-robot added a commit that referenced this pull request Oct 7, 2020
…f-#95130-upstream-release-1.19

Automated cherry pick of #95130: Fix UpdateSnapshot when Node is partially removed
@liggitt liggitt added the kind/regression Categorizes issue or PR as related to a regression from a prior release. label Apr 26, 2022
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. kind/bug Categorizes issue or PR as related to a bug. kind/regression Categorizes issue or PR as related to a regression from a prior release. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node Snapshot can become out-of-sync when Node is deleted before its Pods
6 participants