Skip to content

fix: update node usage when a bound pod's requests change - #547

Open
lbarrosby wants to merge 1 commit into
awslabs:mainfrom
lbarrosby:fix/pod-requests-on-update
Open

lbarrosby wants to merge 1 commit into
awslabs:mainfrom
lbarrosby:fix/pod-requests-on-update

Conversation

@lbarrosby

Copy link
Copy Markdown

When a pod that is already bound gets updated with different requests (for example an in-place resize), the node usage isn't updated. BindPod only adds requests the first time a pod is bound, and DeletePod subtracts the pod's current requests. So after a resize from 1 to 3 CPU the node keeps showing 1 CPU used, and after the pod is deleted it shows -2 CPU.

This keeps the requests that were counted for each bound pod and uses them when the pod is bound again or deleted.

Added TestClusterUpdatePodRequests, which fails on main (expected 3 CPU used after the update, got 1 / got -2 after delete). go test ./pkg/... and go vet pass.

BindPod only added a pod's requests the first time it was bound, and
DeletePod subtracted whatever the pod requested at deletion time. After
an in-place resize the usage kept the old value, and deleting the pod
then left the node usage off by the difference (it could go negative).

Track the requests counted for each bound pod and use them when the
pod is re-bound or deleted.
@lbarrosby
lbarrosby requested a review from a team as a code owner November 5, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant