Skip to content

[release-0.20] pod: don't build a new group Workload from terminating pods - #17501

Merged
kubernetes-prow[bot] merged 2 commits into
kubernetes-sigs:release-0.20from
k8s-infra-cherrypick-robot:cherry-pick-17454-to-release-0.20
Oct 20, 2026
Merged

kubernetes-prow[bot] merged 2 commits into
kubernetes-sigs:release-0.20from
k8s-infra-cherrypick-robot:cherry-pick-17454-to-release-0.20

Conversation

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown
Contributor

This is an automated cherry-pick of #17454

/assign mimowo

Pod integration: Fixed a bug where a pod group's new Workload could be built from a pod still terminating on a node, pinning it there so it could not be admitted. The fix is on by default through the Beta `FinalizeTerminatingPodGroups` feature gate.

/kind bug

A pod group's Workload is built from its pods, with each PodSet template
copied from a pod's spec. A pod that is being deleted but is still bound
to a node counts as runnable, so it can be picked. Its spec still holds
the earlier admission: nodeName, the flavor's node labels and the TAS
hostname nodeSelector. The new Workload then fits only that node, and a
multi-node gang can never be admitted.

This happens when the group's Workload is deleted and replacement pods
arrive while the old pods are still in their grace period. The
FinalizeTerminatingPodGroups gate only acted when every pod of the
group was terminating, so it missed groups that mix old and new pods.

With FinalizeTerminatingPodGroups enabled, building a new group
Workload now also leaves out the pods that are being deleted on a node:
Kueue removes their finalizer, and they do not count toward the group
size, shape the PodSets, own the Workload or get its events. The check
is for a non-zero deletionTimestamp, since the bug happens during the
grace period, while the timestamp is still in the future. Replacement
accounting for an existing Workload is unchanged.

Once that Workload exists, the old pods still count as excess for it,
and removeExcessPods expected an event for each of them. A pod that is
already being deleted and has lost Kueue's finalizer is neither patched
nor deleted, so no event came and the group's pods stayed gated until
the old pods were gone. removeExcessPods now marks such a pod as
observed right away, as finalizePods already does. This part is not
gated.

Signed-off-by: Hao Zhu <zhuhaoangus@gmail.com>
Load used the first listed pod to represent a pod group, and that pod
can be one that is being deleted. Building a new group Workload then
switched to a live pod, but only inside that build. The cache lists pods
in no fixed order, so other reconciles, and the earlier steps of the same
reconcile, could still read a terminating pod. For example, an old pod
with another queue-name label could rewrite the queue of the Workload
that was built from the live pods.

With FinalizeTerminatingPodGroups enabled, Load now picks a pod that is
not being deleted whenever the group has one. The switch in
dropTerminatingPods is no longer needed and is removed.

Signed-off-by: Hao Zhu <zhuhaoangus@gmail.com>
@kubernetes-prow kubernetes-prow Bot 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. labels Oct 20, 2026
@kubernetes-prow kubernetes-prow Bot added this to the v0.20 milestone Oct 20, 2026
@netlify

netlify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for kubernetes-sigs-kueue ready!

Name Link
🔨 Latest commit 6bcde89
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-kueue/deploys/6ad7a8a80a532fa4fe1d26e3
😎 Deploy Preview https://deploy-preview-17501--kubernetes-sigs-kueue.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review: 1
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: kubernetes-sigs/kueue/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4f0a583d-7a54-4cdb-943c-f800ab872588

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@kubernetes-prow kubernetes-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 20, 2026
@mimowo

mimowo commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 20, 2026
@kubernetes-prow

Copy link
Copy Markdown

LGTM label has been added.

DetailsGit tree hash: 470a8dbf9727522537c03526b0ab451c884b1f49

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: k8s-infra-cherrypick-robot, mimowo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 20, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit 31b6231 into kubernetes-sigs:release-0.20 Oct 20, 2026
62 checks passed
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants