Repository navigation
[release-4.22] OCPBUGS-142037: UPSTREAM: 139522: kubelet: fix in-place pod resize with non-admitted pods - #2859
Conversation
…pods Exclude non-admitted pods from allocation capacity calculations. Also skip non-allocated pods in HandlePodUpdates and HandlePodReconcile Signed-off-by: Peter Hunt <pehunt@redhat.com>
|
Pipeline controller notification This PR uses the pipeline controller for second-stage tests. Selection and triggering follow the repository configuration. Use |
|
@haircommander: This pull request references Jira Issue OCPBUGS-64847, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn 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 openshift-eng/jira-lifecycle-plugin repository. |
Pre-merge checks:
|
| Check name | Status | Explanation |
|---|---|---|
| Stable And Deterministic Test Names | The check covers Ginkgo test titles (It, Describe, Context, When, DescribeTable, Entry). This PR is a kubelet backport of upstream #139522. Its new tests are plain Go unit tests in pkg/kubelet, not Gi… |
|
| Test Structure And Quality | The check is not applicable to this PR. It defines quality rules for Ginkgo test code (It blocks, BeforeEach/AfterEach, Eventually timeouts, Gomega assertion messages, and informing markers for new It… | |
| Microshift Test Compatibility | The check applies only when the pull request adds new Ginkgo e2e tests (It/Describe/Context/When). This PR is a kubelet fix backport (openshift/kubernetes PR #2859, author haircommander, base release-… |
|
| Single Node Openshift (Sno) Test Compatibility | Summary: This check applies only when the PR adds new Ginkgo e2e tests (It, Describe, Context, When). The PR does not appear to add any. Evidence: - The PR is openshift/kubernetes #285… |
|
| Topology-Aware Scheduling Compatibility | The check is inapplicable to this pull request. Its scope is deployment manifests, operator code, and controllers that add or modify scheduling constraints (anti-affinity, topology spread, node select… | |
| Ote Binary Stdout Contract | The OTE Binary Stdout Contract check covers only process-level stdout writes in OTE test binaries: main(), init(), TestMain(), suite setup, and top-level initializers. The PR changes kubelet runtime c… | |
| Ipv6 And Disconnected Network Test Compatibility | The check applies only when the pull request adds new Ginkgo e2e tests (It, Describe, Context, When). PR #2859 (author haircommander, base release-4.22) changes four files against … | |
| No-Weak-Crypto | no-weak-crypto: PASS. The PR changes kubelet pod-resource accounting, not cryptography. The PR description names these changed areas: getAllocatedPods(), HandlePodUpdates / `HandlePodReconcile… |
|
| Container-Privileges | The container-privileges check looks for privileged: true, hostPID, hostNetwork, hostIPC, SYS_ADMIN, root without justification, and allowPrivilegeEscalation: true in container or Kubernetes manifests… | |
| No-Sensitive-Data-In-Logs | The PR adds two log statements, and neither exposes sensitive data. - pkg/kubelet/kubelet.go:2822 (in HandlePodUpdates): `klog.V(4).InfoS("Skipping pod update for non-allocated pod", "pod", klog.K… |
Full details: Stable And Deterministic Test Names
-
Explanation
The check covers Ginkgo test titles (It, Describe, Context, When, DescribeTable, Entry). This PR is a kubelet backport of upstream
#139522. Its new tests are plain Go unit tests in pkg/kubelet, not Ginkgo specs: -TestNonAllocatedPodsExcludedFromCapacity_ResizeandTestNonAllocatedPodsExcludedFromCapacity_AddPodin pkg/kubelet/allocation/allocation_manager_test.go (lines 2483 and 2522). - A newsetAllocation: falsetable case inTestHandlePodReconcile_RetryPendingResizesin pkg/kubelet/kubelet_test.go (line 4584). pkg/kubelet contains no Ginkgo imports. These Go function names are static strings with no pod names, timestamps, UUIDs, node names, or IP addresses, so they would pass the naming rules even if they were in scope. The PR description names test/e2e/node/pod_admission.go as the existing reproducer for the poisoning. Its title, "should reject pod when the node didn't have enough resource", is static and contains no dynamic values. The repository is a single root commit, so I could not confirm the full diff against the base. The description and the kubelet-scoped file evidence do not indicate any e2e Ginkgo title was added or changed. I found no Ginkgo title in the PR that violates the check. No legacy openshift-tests-private prefix tokens were found in the PR's test names.
Full details: Test Structure And Quality
-
Explanation
The check is not applicable to this PR. It defines quality rules for Ginkgo test code (It blocks, BeforeEach/AfterEach, Eventually timeouts, Gomega assertion messages, and informing markers for new It() blocks). Evidence: - The PR is a kubelet backport of upstream kubernetes#139522. Its description says the patch touches
getAllocatedPods(),HandlePodUpdates, andHandlePodReconcile, plus unit tests. - The added or extended tests are plain Gotestingfunctions, not Ginkgo specs: -TestNonAllocatedPodsExcludedFromCapacity_AddPodandTestNonAllocatedPodsExcludedFromCapacity_Resizeinpkg/kubelet/allocation/allocation_manager_test.go(around lines 2481-2530). -TestHandlePodReconcile_RetryPendingResizesinpkg/kubelet/kubelet_test.go(line 4584). The PR adds asetAllocation: falsecase to it. - Neither file containsginkgo,gomega,g.It(, orote.Informingreferences. The grep found no matches in either file. -test/e2e/node/pod_admission.gois mentioned only as the reproduction source. The description does not say this PR changes it. Its GinkgoItblock ("should reject pod when the node didn't have enough resource") exists in the tree, but the PR description does not list it as changed. Limitation: the checkout is a single squashed commit with no parent, so the exact per-file PR diff cannot be isolated from git history. The verdict relies on the PR description and on the test function names and content found in the tree. No new Ginkgo It() block appears in the PR scope, so criterion 6 (informing markers) does not apply, and criteria 1-5 do not apply to plain Go unit tests.
Full details: Microshift Test Compatibility
-
Explanation
The check applies only when the pull request adds new Ginkgo e2e tests (It/Describe/Context/When). This PR is a kubelet fix backport (openshift/kubernetes PR
#2859, author haircommander, base release-4.22). Its changes, as described in the PR, are in pkg/kubelet: getAllocatedPods() filtering via HasPodAllocatedResources, and HandlePodUpdates/HandlePodReconcile skipping pods without an allocation. The new tests are standard Go unit tests: TestNonAllocatedPodsExcludedFromCapacity_AddPod in pkg/kubelet/allocation/allocation_manager_test.go and an extra case in TestHandlePodReconcile_RetryPendingResizes in pkg/kubelet/kubelet_test.go. Both tests exist in the checkout. No g.It/ginkgo.It usage appears in pkg/kubelet/allocation, status, or lifecycle. The PR description names test/e2e/node/pod_admission.go only as the pre-existing test that triggers the bug. It does not say that file was modified. Limitation: the local checkout is a single root commit with no parent, so a base-relative diff could not be computed. The conclusion relies on the PR description and on the content of the named test files. No new Ginkgo e2e test is identified, so no MicroShift compatibility concern is raised.
Full details: Single Node Openshift (Sno) Test Compatibility
-
Explanation
Summary: This check applies only when the PR adds new Ginkgo e2e tests (
It,Describe,Context,When). The PR does not appear to add any. Evidence: - The PR is openshift/kubernetes#2859(author loginhaircommander, baserelease-4.22). It backports upstream kubernetes#139522, a kubelet in-place resize fix. - The PR description lists the changes asgetAllocatedPods()filtering onHasPodAllocatedResources, plusHandlePodUpdates/HandlePodReconcileskipping pods without an allocation. It also lists the new unit testTestNonAllocatedPodsExcludedFromCapacity_AddPodand an extrasetAllocation: falsecase inTestHandlePodReconcile_RetryPendingResizes. These are Gotestingunit tests inpkg/kubelet, not Ginkgo specs. -test/e2e/node/pod_admission.gois cited only as the existing test that triggers the bug. The PR does not add or change it. - I searched the added lines of the carry commit for Ginkgo constructs (g.It(,g.Describe(,g.Context(,g.When(,ginkgo.It(,framework.ConformanceIt). The only matches were unrelated code such asrequest.Context(),RateLimiter.When(), and existing[Skipped:...]label helpers in shared framework code. None were new e2e specs. Limitation: The checkout'sHEADcommit is a full-tree snapshot with no usable parent. I could not isolate the exact PR diff from git, so this verdict rests on the PR description and the kubelet-scoped file list. Any new Ginkgo spec added outside that description would change the result. Conclusion: No new Ginkgo e2e tests are introduced, so the SNO topology criteria do not apply. The check passes.
Full details: Topology-Aware Scheduling Compatibility
-
Explanation
The check is inapplicable to this pull request. Its scope is deployment manifests, operator code, and controllers that add or modify scheduling constraints (anti-affinity, topology spread, node selectors, tolerations, PDBs, replica counts). PR #2859 (target release-4.22, author haircommander) is a backport of upstream kubernetes#139522. It changes kubelet pod-admission accounting. The changed logic is in pkg/kubelet/allocation/allocation_manager.go: getAllocatedPods() now keeps only pods where HasPodAllocatedResources is true. HandlePodUpdates and HandlePodReconcile skip pods without an allocation. The PR also adds unit tests. The PR description cites test/e2e/node/pod_admission.go, which exercises kubelet rejection. None of this adds or changes a deployment manifest, operator, controller, or scheduling constraint. The kubelet capacity check is not a scheduling constraint in the check's sense. Limitation: the sandbox checkout is a single squashed commit with no parent, so I could not produce a full file-level diff. I confirmed the allocation-manager code and the PR description, and I found no manifest or operator changes in the PR description.
Full details: Ote Binary Stdout Contract
-
Explanation
The OTE Binary Stdout Contract check covers only process-level stdout writes in OTE test binaries: main(), init(), TestMain(), suite setup, and top-level initializers. The PR changes kubelet runtime code. Per the PR description and the local tree, the changes sit in pkg/kubelet: getAllocatedPods() in kubelet_pods.go and allocation_manager.go, HandlePodUpdates/HandlePodReconcile, and the unit tests TestNonAllocatedPodsExcludedFromCapacity_AddPod and TestHandlePodReconcile_RetryPendingResizes. The description names test/e2e/node/pod_admission.go only as the existing test that triggers the bug. It does not say that file changed. A search of the kubelet files involved (pkg/kubelet/allocation, kubelet_pods.go, kubelet.go, pod_workers.go) found no fmt.Print*, os.Stdout, klog.SetOutput, or LogToStderr uses. The checkout is a single squashed commit with no parent, so I could not produce a per-file diff. That limits certainty about the exact file list. Nothing in the described scope falls under the check's process-level criteria, so the check is inapplicable.
Full details: Ipv6 And Disconnected Network Test Compatibility
-
Explanation
The check applies only when the pull request adds new Ginkgo e2e tests (It, Describe, Context, When). PR #2859 (author haircommander, base release-4.22) changes four files against its parent commit e2a920b: pkg/kubelet/allocation/allocation_manager.go, pkg/kubelet/allocation/allocation_manager_test.go, pkg/kubelet/kubelet.go, and pkg/kubelet/kubelet_test.go. No file under test/ changes, and a diff search for added It(, Describe(, Context(, or When( blocks found none. The new test, TestNonAllocatedPodsExcludedFromCapacity_AddPod, is a Go unit test in pkg/kubelet/allocation and not a Ginkgo e2e test. The existing PodRejectionStatus e2e test in test/e2e/node/pod_admission.go is unchanged and is only referenced in the PR description. Because no new e2e test is added, the IPv4 and external-connectivity criteria do not apply.
Full details: No-Weak-Crypto
-
Explanation
no-weak-crypto: PASS. The PR changes kubelet pod-resource accounting, not cryptography. The PR description names these changed areas:
getAllocatedPods(),HandlePodUpdates/HandlePodReconcile,PushPendingResize/AddPod/SetAllocatedResources, andtest/e2e/node/pod_admission.go. Evidence gathered: - The local checkout holds a single root commit (3c2bec97, no parent). Its full tree is therefore present, and a base-to-head diff could not be isolated. I did not treat the whole tree as PR-introduced. - Scanning the added lines of the commit for weak-crypto patterns returned only generic TLS and certificate code from the vendored API types and generated files, such asTLSCipherSuites,crypto/x509, andcrypto/tls. None of these lines is a weak primitive or a weak mode. - The files named in the PR description (allocation_manager.goand its test,kubelet.go,kubelet_pods.go,pod_workers.go,status_manager.go,lifecycle/predicate.go,test/e2e/node/pod_admission.go) contain no MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB, or custom cipher usage. - A repo-wide import scan ofpkg/kubeletandtest/e2e/nodefound no imports ofcrypto/md5,crypto/sha1,crypto/des,crypto/rc4, orgolang.org/x/crypto/blowfish. - The onlybytes.Equalhit in the scanned files is inpkg/kubelet/allocationcode that compares pod-resource data, not a secret or token. No secret or token comparison appears in the PR's changed areas. Limitation: the PR patch was not isolated as a diff. The PASS rests on the PR description's scope and on the scan of the named and kubelet files. The check does not define a failure for a missing diff.
Full details: Container-Privileges
-
Explanation
The container-privileges check looks for privileged: true, hostPID, hostNetwork, hostIPC, SYS_ADMIN, root without justification, and allowPrivilegeEscalation: true in container or Kubernetes manifests. Evidence gathered: - The PR is openshift/kubernetes
#2859by haircommander, targeting release-4.22. The contributor describes it as a kubelet backport of upstream#139522. It changes pod admission accounting ingetAllocatedPods()and skips pods without an allocation inHandlePodUpdates/HandlePodReconcile. It also adds unit tests. - The checked-out HEAD is a single root commit with no parent. Git cannot isolate the PR delta from a base, so the full patch could not be diffed directly. - Within the commit's kubelet and e2e Go paths, I found no added container manifest or security setting tied to this change. TheHasPodAllocatedResourcesandgetAllocatedPodslogic is present inpkg/kubelet/allocation/allocation_manager.go. -test/e2e/node/pod_admission.go(the PodRejectionStatus test named in the description) sets no Privileged, host*, SYS_ADMIN, or allowPrivilegeEscalation field. It only requests CPU and expectsOutOfcpu. - Grep hits forPrivilegedorHostNetworkin the commit come from unrelated pre-existing test code and vendored or generated files. They are not part of the described PR changes. - No YAML or JSON manifest in the PR scope is described as adding privileged, host namespace, or capability settings. The PR does not introduce any condition the check lists. Limitation: the root-commit snapshot prevents a strict file-by-file diff confirmation, so this rests on the PR description and the targeted code inspection.
Full details: No-Sensitive-Data-In-Logs
-
Explanation
The PR adds two log statements, and neither exposes sensitive data. -
pkg/kubelet/kubelet.go:2822(inHandlePodUpdates):klog.V(4).InfoS("Skipping pod update for non-allocated pod", "pod", klog.KObj(pod), "podUID", pod.UID). -pkg/kubelet/kubelet.go:3050(inHandlePodReconcile):klog.V(4).InfoS("Skipping pod reconcile operations for non-allocated pod", "pod", klog.KObj(pod), "podUID", pod.UID). Both log only the namespace/name reference and the pod UID. They log no passwords, tokens, API keys, PII, session IDs, hostnames, or customer payload data. The other log calls in the touched files predate this change, and none of them is new in this diff. The changes togetAllocatedPods()and the test files add no logging. Limitation: the checkout is a single squashed commit with no parent, so I identified the added lines by reading the changed functions. I did not run a line-level diff. The grep over the touched kubelet files found no other sensitive-data keywords in log calls.
|
@haircommander: the contents of this pull request could be automatically validated. The following commits are valid:
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@haircommander: This pull request references Jira Issue OCPBUGS-142037, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn 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 openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@haircommander: This pull request references Jira Issue OCPBUGS-142037, which is invalid:
Comment DetailsIn 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 openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@haircommander: This pull request references Jira Issue OCPBUGS-142037, which is invalid:
Comment DetailsIn 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 openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@haircommander: This pull request references Jira Issue OCPBUGS-142037, which is valid. The bug has been moved to the POST state. 7 validation(s) were run on this bug
DetailsIn 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 openshift-eng/jira-lifecycle-plugin repository. |
|
/pipeline required |
|
Scheduling required tests: Scheduling tests matching the |
|
@haircommander: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
/kind bug
What this PR does / why we need it:
Backports upstream kubernetes#139522 to release-4.22 (carry of
UPSTREAM: 139522, same patch already merged to master via #2667 and shipped in 5.0/5.1).When a pod is rejected at admission (
OutOfcpu), it stays inGetActivePods()with no entry in the allocation checkpoint.getAllocatedPods()returned it unchanged, so its full spec request was summed into the "used" value for every subsequent admission on that node:The poisoner is
test/e2e/node/pod_admission.go(PodRejectionStatus), which requestscpu: 1000000000000and force-Binds the pod to the node to exercise the kubelet rejection path.1e12cores =1e15millicores, which is the1000000000000000in the message above (plus ~3188m of legitimately running pods). The next pod created on the node is rejected, which is how it shows up as a failure in unrelated tests, e.g.[sig-node] Pod InPlace Resize Container guaranteed qos - 1 container with resize policy cpu & mem restart resizing cpu & mem in the same direction:https://prow.ci.openshift.org/view/gs/test-platform-results-public/logs/periodic-ci-openshift-release-main-ci-4.22-e2e-aws-upgrade-ovn-single-node/2120057983105765376
The fix folds two changes:
getAllocatedPods()only returns pods that actually have an allocation (HasPodAllocatedResources), so pods that are pending admission or were rejected do not count against node capacity.HandlePodUpdates/HandlePodReconcileskip pods without an allocation, so a rejected pod is never handed to the pod workers and cannot be treated as actively terminating.Backport notes: release-4.22 is based on Kubernetes v1.35, where
PushPendingResize/AddPod/SetAllocatedResourcesdo not take a logger/context yet, andHandlePodReconcilehas no terminal-pod retry branch. The patch is otherwise 1:1 with the upstream commit, including its unit tests. The extrasetAllocation: falsecase added toTestHandlePodReconcile_RetryPendingResizescovers the 1.35 equivalent of upstream's "allocation already purged" case: with no allocation the effective requests fall back to the spec, so no shrink is observed and no spurious retry is triggered.Which issue(s) this PR is related to:
https://redhat.atlassian.net/browse/OCPBUGS-142037 (4.22 tracking bug)
https://redhat.atlassian.net/browse/OCPBUGS-64847 (5.0 variant, fixed via RHEA-2026:4893)
Upstream: kubernetes#139522
Special notes for your reviewer:
OCPBUGS-142037 blocks OCPBUGS-64847: the 5.0 bug is closed because the kubelet fix shipped there, while release-4.22 still carries the unfixed accounting.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
Testing
go build ./pkg/kubelet/...go test ./pkg/kubelet/(passes)go test ./pkg/kubelet/allocation/... ./pkg/kubelet/status/... ./pkg/kubelet/lifecycle/...(passes)TestNonAllocatedPodsExcludedFromCapacity_AddPodreproduces the reported failure (a pending, never-allocated pod requesting 10 CPU must not block admission of a new pod) and fails without thegetAllocatedPods()change.AI was used to port this backport and to draft this description; the change was reviewed and tested as above and the author is responsible for the contents.