-
Notifications
You must be signed in to change notification settings - Fork 41.1k
when a pod fails to allocate partial resources, leading to UnexpectedAdmissionError #130172
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: master
Are you sure you want to change the base?
Conversation
Hi @novahe. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: novahe The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/ok-to-test |
/test pull-kubernetes-e2e-gce |
@ffromani PTAL |
/triager accepted Thanks for the fix! I have 2 major concerns:
|
61ae346
to
00215e8
Compare
Hi @ffromani , I’ve tried to create a scenario for the bug. Please take a look when you have time. |
00215e8
to
f961c55
Compare
/test pull-kubernetes-e2e-kind |
f961c55
to
986527b
Compare
986527b
to
75dfe73
Compare
…ices to avoid generating stale data.
75dfe73
to
dbf9a25
Compare
thanks @novahe the code fix per se makes sense to me. Wil carefully review the testcase. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/reopen @ffromani this seems to be a useful fix. Will you have time to review? |
@SergeyKanzhelev: Reopened this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@novahe: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
tmpDir, err := os.MkdirTemp("", "checkpoint") | ||
as.NoError(err) | ||
defer func(path string) { | ||
err := os.RemoveAll(path) | ||
if err != nil { | ||
t.Fatalf("Fail to remove tmpdir: %v", err) | ||
} | ||
}(tmpDir) |
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.
tmpDir, err := os.MkdirTemp("", "checkpoint") | |
as.NoError(err) | |
defer func(path string) { | |
err := os.RemoveAll(path) | |
if err != nil { | |
t.Fatalf("Fail to remove tmpdir: %v", err) | |
} | |
}(tmpDir) | |
tmpDir := t.TempDir() |
Preferred: true, | ||
} | ||
testManager, err := getTestManager(tmpDir, func() []*v1.Pod { return []*v1.Pod{} }, testResources) | ||
as.NoError(err) |
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.
nit:
as.NoError(err) | |
require.NoError(err) |
@@ -851,6 +851,9 @@ func (m *ManagerImpl) allocateContainerResources(pod *v1.Pod, container *v1.Cont | |||
} | |||
allocDevices, err := m.devicesToAllocate(podUID, contName, resource, needed, devicesToReuse[resource]) | |||
if err != nil { | |||
m.mutex.Lock() | |||
m.allocatedDevices = m.podDevices.devices() | |||
m.mutex.Unlock() |
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.
There are 2 more identical pieces of code in this function. Would it make sense to use defer?
When
m.devicesToAllocate
fails, it is necessary to resetm.allocatedDevices
to avoid generating stale data.What type of PR is this?
/kind bug
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #130145
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: