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

[1.26] kubelet: devices: skip allocation for running pods #118635 #119706

Conversation

ffromani
Copy link
Contributor

@ffromani ffromani commented Aug 1, 2023

What type of PR is this?

/kind bug
/kind regression

What this PR does / why we need it:

Cherry-pick of #118635 to branch release-1.26 through #119432. Cherry pick per se done using hack/cherry_pick_pull.sh

Original description

When kubelet initializes, runs admission for pods and possibly allocate requested resources. We need to distinguish between node reboot (no containers running) versus kubelet restart (containers potentially running).

Running pods should always survive kubelet restart. This means that device allocation on admission should not be attempted, because if a container requires devices and is still running when kubelet is restarting, that container already has devices allocated and working.

Thus, we need to properly detect this scenario in the allocation step and handle it explicitely. We need to inform the devicemanager about which pods are already running.

Which issue(s) this PR fixes:

Fixes #118559

Special notes for your reviewer:

Implements the first approach proposed in the thread, so we make the devicemanager treat running pod differently.

This approach was chosen because it seems simpler to make self-contained and easier to backport.

The devicemanager already tracks (with the help of the checkpoint files) which containers got devices assigned to them, which by definition means these containers passed its admission. The missing bit is safely learning which container are already running when initializing, and for that we extend the existing buildContainerMapFromRuntime

Does this PR introduce a user-facing change?

Fixes regression in 1.26.5 causing running pods with devices to be terminated if kubelet is restarted

@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Aug 1, 2023
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/cherry-pick-not-approved Indicates that a PR is not yet approved to merge into a release branch. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 1, 2023
@ffromani
Copy link
Contributor Author

ffromani commented Aug 1, 2023

/sig node

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/node Categorizes an issue or PR as relevant to SIG Node. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 1, 2023
@k8s-ci-robot k8s-ci-robot added area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Aug 1, 2023
@ffromani
Copy link
Contributor Author

ffromani commented Aug 1, 2023

/retest

seems unrelated

@ffromani
Copy link
Contributor Author

ffromani commented Aug 1, 2023

/test pull-kubernetes-e2e-gce-serial
/test pull-kubernetes-node-e2e-containerd

@bart0sh bart0sh added this to Triage in SIG Node PR Triage Aug 1, 2023
@swatisehgal
Copy link
Contributor

/triage accepted
/priority important-soon

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 1, 2023
@ffromani ffromani force-pushed the automated-cherry-pick-of-#119432-upstream-release-1.26-1690878669 branch from 211504b to 180aa30 Compare August 8, 2023 11:36
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 8, 2023
@ffromani
Copy link
Contributor Author

ffromani commented Aug 8, 2023

rebased to fix a conflict

@ffromani
Copy link
Contributor Author

ffromani commented Aug 8, 2023

/test pull-kubernetes-e2e-capz-windows-containerd-1-26

Copy link
Contributor

@swatisehgal swatisehgal left a comment

Choose a reason for hiding this comment

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

/lgtm

Re-applying as the label was removed due to rebase

@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, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: d19eb9ab87ddee587ebee47c21c0756e51cf41ab

@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 22, 2023
@bobbypage
Copy link
Member

/lgtm

@bobbypage
Copy link
Member

/cc @kubernetes/release-managers

Release managers, can you please take a look at this cherrypick? Thank you!

@k8s-ci-robot k8s-ci-robot requested a review from a team August 22, 2023 19:46
@SergeyKanzhelev SergeyKanzhelev moved this from Needs Approver to Done in SIG Node PR Triage Aug 23, 2023
@SergeyKanzhelev SergeyKanzhelev moved this from PRs - Needs Approver to Done in SIG Node CI/Test Board Aug 23, 2023
@ffromani
Copy link
Contributor Author

/hold cancel

1.27 woes solved - and I think we won't merge cherry-picks out of expected order anyway

@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 Aug 24, 2023
SIG Node CI/Test Board automation moved this from Done to PRs - Needs Approver Aug 30, 2023
Copy link
Member

@xmudrii xmudrii left a comment

Choose a reason for hiding this comment

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

For RelEng:
/lgtm
/approve

@xmudrii xmudrii added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Aug 30, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/cherry-pick-not-approved Indicates that a PR is not yet approved to merge into a release branch. label Aug 30, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ffromani, mrunalp, xmudrii

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 merged commit 77d1f7a into kubernetes:release-1.26 Aug 30, 2023
17 checks passed
SIG Node CI/Test Board automation moved this from PRs - Needs Approver to Done Aug 30, 2023
@ffromani ffromani deleted the automated-cherry-pick-of-#119432-upstream-release-1.26-1690878669 branch August 30, 2023 14:24
@k8s-ci-robot k8s-ci-robot 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 Sep 9, 2023
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. area/kubelet area/test cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. 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/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Development

Successfully merging this pull request may close these issues.

None yet

9 participants