Repository: kubernetes/kubernetes
Pull request #131278: scheduler: remove duplicate nominatedNodeName clearing in preemption
Author: login: haosdent
Labels: name: area/test
name: kind/cleanup
description: Categorizes issue or PR as related to cleaning up code, process, or technical debt.
name: sig/scheduling
description: Categorizes an issue or PR as relevant to SIG Scheduling.
name: lgtm
description: "Looks good to me", indicates that a PR is ready to be merged.
name: size/M
description: Denotes a PR that changes 30-99 lines, ignoring generated files.
name: release-note-none
description: Denotes a PR that doesn't merit a release note.
name: approved
description: Indicates a PR has been approved by an approver from all required OWNERS files.
name: cncf-cla: yes
description: Indicates the PR's author has signed the CNCF CLA.
name: sig/testing
description: Categorizes an issue or PR as relevant to SIG Testing.
name: ok-to-test
description: Indicates a non-member PR verified by an org member that is safe to test.
name: needs-priority
description: Indicates a PR lacks a `priority/foo` label and requires one.
name: needs-triage
description: Indicates an issue or PR lacks a `triage/foo` label and requires one.
Created: 2025-04-13T15:50:34Z | Merged: 2025-04-24T01:20:30Z

When preemption finds no candidates, it currently makes an explicit API call to clear the pod's nominatedNodeName in findCandidates(). However, this is redundant because:

1. When no candidates are found, Preempt() returns a PostFilterResult with an empty nominatedNodeName via NewPostFilterResultWithNominatedNode("")
2. This empty nominatedNodeName is propagated through the scheduling cycle to handleSchedulingFailure()
3. handleSchedulingFailure() then properly clears the nominatedNodeName through updatePod()

Remove the explicit ClearNominatedNodeName call in findCandidates() to reduce unnecessary API calls while maintaining the same behavior.

This change improves performance by eliminating a duplicate API call without changing the functional behavior of preemption.

<!--  Thanks for sending a pull request!  Here are some tips for you:

1. If this is your first time, please read our contributor guidelines: https://git.k8s.io/community/contributors/guide/first-contribution.md#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request. For reference on required PR/issue labels, read here:
https://git.k8s.io/community/contributors/devel/sig-release/release.md#issuepr-kind-label
3. Ensure you have added or ran the appropriate tests for your PR: https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
4. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
5. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
-->

#### What type of PR is this?

/kind cleanup

#### What this PR does / why we need it:

#### Which issue(s) this PR fixes:

Fixes #131239

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".

For more information on release notes see: https://git.k8s.io/community/contributors/guide/release-notes.md
-->
```release-note
NONE
```

#### Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

<!--
This section can be blank if this pull request does not require a release note.

When adding links which point to resources within git repositories, like
KEPs or supporting documentation, please reference a specific commit and avoid
linking directly to the master branch. This ensures that links reference a
specific point in time, rather than a document that may change over time.

See here for guidance on getting permanent links to files: https://help.github.com/en/articles/getting-permanent-links-to-files

Please use the following format for linking documentation:
- [KEP]: <link>
- [Usage]: <link>
- [Other doc]: <link>
-->
```docs

```


Linked issue #131239: Don't clear nominatedNodeName in preemption if no candidates are found, because it is cleared later anyway
Now, if we want to try a preemption of a pod and no candidates are found, `nominatedNodeName` is cleared for a pod in the preemption code:

https://github.com/kubernetes/kubernetes/blob/88dfcb225d41326113990e87b11137641c121a32/pkg/scheduler/framework/preemption/preemption.go#L316-L324

But, because we return `framework.NewPostFilterResultWithNominatedNode("")` anyway when there are no candidates:

https://github.com/kubernetes/kubernetes/blob/88dfcb225d41326113990e87b11137641c121a32/pkg/scheduler/framework/preemption/preemption.go#L263-L276

The nominatedNodeName will be cleared in the `handleSchedulingFailure` in the scheduling cycle:

https://github.com/kubernetes/kubernetes/blob/88dfcb225d41326113990e87b11137641c121a32/pkg/scheduler/schedule_one.go#L1088-L1096

So, we can remove the `ClearNominatedNodeName` in `findCandidates`, because it's a duplicated effort.

Reducing number of API calls could improve performance.

/kind feature
/sig scheduling
Linked issue comments: user: login: k8s-ci-robot
created_at: 2025-04-10T11:55:03Z
body: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the `triage/accepted` label and provide further guidance.

The `triage/accepted` label can be added by org members by writing `/triage accepted` in a comment.


<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
</details>
author_association: CONTRIBUTOR
user: login: macsko
created_at: 2025-04-10T11:55:06Z
body: /cc @dom4ha @sanposhiho 
author_association: MEMBER
user: login: sanposhiho
created_at: 2025-04-10T15:11:13Z
body: +1
author_association: MEMBER
user: login: dom4ha
created_at: 2025-04-11T11:09:35Z
body: Yes, definitely. The scheduling part should not have any api calls and the ones in `handleSchedulingFailure` we will make async.
author_association: MEMBER
user: login: haosdent
created_at: 2025-04-13T15:52:16Z
body: Submit the cleanup at https://github.com/kubernetes/kubernetes/pull/131278
author_association: MEMBER
user: login: sanposhiho
created_at: 2025-04-13T22:25:16Z
body: @haosdent Thanks. Just for the future, please ensure you get the assignment by `/assign` comment before starting the task so that we can prevent double efforts made by different people.

/assign @haosdent 


author_association: MEMBER
user: login: haosdent
created_at: 2025-04-14T02:14:57Z
body: Got it, thanks @sanposhiho 
author_association: MEMBER

Diff:
diff --git a/pkg/scheduler/framework/preemption/preemption.go b/pkg/scheduler/framework/preemption/preemption.go
index d23c18595ccd4..edaaad94c08c7 100644
--- a/pkg/scheduler/framework/preemption/preemption.go
+++ b/pkg/scheduler/framework/preemption/preemption.go
@@ -315,11 +315,6 @@ func (ev *Evaluator) findCandidates(ctx context.Context, state *framework.CycleS
 	}
 	if len(potentialNodes) == 0 {
 		logger.V(3).Info("Preemption will not help schedule pod on any node", "pod", klog.KObj(pod))
-		// In this case, we should clean-up any existing nominated node name of the pod.
-		if err := util.ClearNominatedNodeName(ctx, ev.Handler.ClientSet(), pod); err != nil {
-			logger.Error(err, "Could not clear the nominatedNodeName field of pod", "pod", klog.KObj(pod))
-			// We do not return as this error is not critical.
-		}
 		return nil, framework.NewDefaultNodeToStatus(), nil
 	}
 
diff --git a/test/integration/scheduler/preemption/preemption_test.go b/test/integration/scheduler/preemption/preemption_test.go
index a1b6acb7458a1..0b0bb0fd38e68 100644
--- a/test/integration/scheduler/preemption/preemption_test.go
+++ b/test/integration/scheduler/preemption/preemption_test.go
@@ -1526,14 +1526,16 @@ func newAlwaysFail(_ context.Context, _ runtime.Object, _ framework.Handle) (fra
 // properly in different scenarios.
 func TestNominatedNodeCleanUp(t *testing.T) {
 	tests := []struct {
-		name         string
+		name string
+		// Initial nodes to simulate special conditions.
+		initNodes    []*v1.Node
 		nodeCapacity map[v1.ResourceName]string
 		// A slice of pods to be created in batch.
 		podsToCreate [][]*v1.Pod
 		// Each postCheck function is run after each batch of pods' creation.
 		postChecks []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error
 		// Delete the fake node or not. Optional.
-		deleteNode bool
+		deleteFakeNode bool
 		// Pods to be deleted. Optional.
 		podNamesToDelete []string
 
@@ -1600,8 +1602,39 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
+			name: "mid-priority pod preempts low-priority pod at the beginning, but could not find candidates after the nominated node is deleted",
+			// Create a taint node to simulate the `UnschedulableAndUnresolvable` condition in `findCandidates` during preemption.
+			initNodes: []*v1.Node{
+				st.MakeNode().Name("taint-node").Capacity(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).
+					Taints([]v1.Taint{
+						{
+							Key:    "taint-node",
+							Value:  "true",
+							Effect: v1.TaintEffectNoSchedule,
+						},
+					}).
+					Obj(),
+			},
+			nodeCapacity: map[v1.ResourceName]string{v1.ResourceCPU: "1"},
+			podsToCreate: [][]*v1.Pod{
+				{
+					st.MakePod().Name("low").Priority(lowPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+				{
+					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+			},
+			postChecks: []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error{
+				testutils.WaitForPodToSchedule,
+				testutils.WaitForNominatedNodeName,
+			},
+			// Delete the fake node to trigger the `UnschedulableAndUnresolvable` condition in `findCandidates`.
+			deleteFakeNode:   true,
 			podNamesToDelete: []string{"low"},
 		},
 		{
@@ -1648,6 +1681,12 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				)
 
 				cs, ns := testCtx.ClientSet, testCtx.NS.Name
+				for _, node := range tt.initNodes {
+					if _, err := createNode(cs, node); err != nil {
+						t.Fatalf("Error creating initial node %v: %v", node.Name, err)
+					}
+				}
+
 				// Create a node with the specified capacity.
 				nodeName := "fake-node"
 				if _, err := createNode(cs, st.MakeNode().Name(nodeName).Capacity(tt.nodeCapacity).Obj()); err != nil {
@@ -1672,8 +1711,8 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 					}
 				}
 
-				// Delete the node if necessary.
-				if tt.deleteNode {
+				// Delete the fake node if necessary.
+				if tt.deleteFakeNode {
 					if err := cs.CoreV1().Nodes().Delete(testCtx.Ctx, nodeName, *metav1.NewDeleteOptions(0)); err != nil {
 						t.Fatalf("Node %v cannot be deleted: %v", nodeName, err)
 					}


Reviews:
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T10:53:41Z
user: login: haosdent
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T11:13:34Z
user: login: haosdent
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T11:15:48Z
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T11:27:34Z
user: login: haosdent
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T12:37:44Z
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T13:27:25Z
user: login: haosdent
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T14:39:40Z
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T14:50:48Z
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T14:51:56Z
user: login: haosdent
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T14:59:51Z
user: login: haosdent
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T16:58:24Z
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-15T18:58:29Z
user: login: haosdent
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-16T04:19:36Z
user: login: macsko
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-16T09:18:32Z
user: login: haosdent
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-16T09:24:31Z
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-16T09:49:56Z
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-16T09:56:25Z
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-16T10:02:43Z
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-16T10:03:43Z
user: login: sanposhiho
body: /lgtm

Leave the final approval to @macsko 
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-16T10:04:35Z
user: login: haosdent
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-16T11:13:46Z
user: login: haosdent
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-16T11:36:49Z
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-17T10:43:14Z
user: login: sanposhiho
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-17T10:43:32Z

Review comments:
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: can we do it simpler like this:
1. create a medium pod with nominated node name. This pod has a larger resource than nodeCapacity, and hence get unschedulableandunresolvable at filter.
2. the scheduler tries to do preemption, but it doesn't help (since the node itself is smaller than the pod's size)
3. the medium pod lose the nominated node name because the preemption failed.
created_at: 2025-04-15T10:53:41Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: haosdent
body: Thanks for your review. Do you mean add a test case like this?

```
		{
			name:         "pod loses nominated node when preemption cannot help due to insufficient node capacity",
			nodeCapacity: map[v1.ResourceName]string{v1.ResourceCPU: "1"},
			podsToCreate: [][]*v1.Pod{
				{
					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "2"}).NominatedNodeName("fake-node").Obj(),
				},
			},
			postChecks: []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error{
				testutils.WaitForNominatedNodeName,
			},
		},
```

However, it didn't trigger the preemption logic in `findCandidates` according to my test. Do you have any suggestions on this?
created_at: 2025-04-15T11:13:32Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: haosdent
body: > it didn't trigger the preemption logic in findCandidates according to my test. 

I mean it does trigger the `findCandidates` method, but didn't fall in this condition

```
	if len(potentialNodes) == 0 {
		logger.V(3).Info("Preemption will not help schedule pod on any node", "pod", klog.KObj(pod))
		return nil, framework.NewDefaultNodeToStatus(), nil
	}
```
created_at: 2025-04-15T11:15:48Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: not sure, any clue on the logs?
created_at: 2025-04-15T11:27:33Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: haosdent
body: > not sure, any clue on the logs?

It is expected because `potentialNodes` would not be empty if the medium pod has a larger resource than the node. The `NodeResourcesFit` would return `framework.Unschedulable` in this situation, resulting in `potentialNodes` becoming non-empty.

```
 	// Get a list of nodes with failed predicates (Unschedulable) that may be satisfied by removing pods from the node. 
 	potentialNodes, err := m.NodesForStatusCode(ev.Handler.SnapshotSharedLister().NodeInfos(), framework.Unschedulable) 
 	if err != nil { 
 		return nil, nil, err 
 	} 
 	if len(potentialNodes) == 0 { 
```

In my changes, I use the `NodeAffinity` plugin (which I created a taint node in the new test case) to simulate this. `NodeAffinity` would return  `UnschedulableAndUnresolvable`, so it could trigger `len(potentialNodes) == 0` condition.
created_at: 2025-04-15T12:37:44Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: Hmm, okay. I was expecting the resource fit plugin would return `UnschedulableAndUnresolvable` for the node that is, in the first place, smaller than the target pod because the preemption wouldn't help for sure.
I opened: https://github.com/kubernetes/kubernetes/issues/131310

---

Using the node selector instead to make this medium pod unschedulable (with UnschedulableAndUnresolvable) sounds good.
created_at: 2025-04-15T13:27:25Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: haosdent
body: I see. Maybe I could update the test case again once #131310 fixed
created_at: 2025-04-15T14:39:39Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: So, now you can just change this test case like this, right?
1. create a medium pod with nominated node name. This pod has a node selector that doesn't match with the node, and hence get unschedulableandunresolvable at filter.
2. the scheduler tries to do preemption, but it doesn't help (we got the unschedulableandunresolvable on the node)
3. the medium pod lose the nominated node name because the preemption failed.
created_at: 2025-04-15T14:50:48Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: In that way, you don't have to implement `initNodes`
created_at: 2025-04-15T14:51:56Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: haosdent
body: > create a medium pod with nominated node name. This pod has a node selector that doesn't match with the node, and hence get unschedulableandunresolvable at filter.

Yes, I try this at the beginning as well. But somehow the nomiatedNodeName are clear and didn't trigger `if len(potentialNodes) == 0`. I need to add more logs and check how it happen tmr.
created_at: 2025-04-15T14:59:51Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: haosdent
body: Just do a quick test again, it looks like `Pod.Status` would be ignore when `testutils.CreatePausePod`

I try to use this code snippet
```
				{
					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "2"}).
						NominatedNodeName("node-1").
						NodeAffinityIn("node", []string{"node-1"}, st.NodeSelectorTypeMatchExpressions).Obj(),
				},
```

to create the pod.

And I call `testutils.GetPod` after call `testutils.CreatePausePod`, the response of `testutils.GetPod` show empty `Status.NominatedNodeName`.

created_at: 2025-04-15T16:58:24Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: Ah, so `CreatePausePod` doesn't care about the status update. I think the pod's status is subresource, and hence we have to explicitly update the status. Can you change `CreatePausePod` like that?
created_at: 2025-04-15T18:58:29Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: haosdent
body: > Can you change CreatePausePod like that?

Just check it, this would not work because we create pod with spec and udpate pod with status in 2 different steps.
When the scheduler receives the pod, its status may still be empty.

created_at: 2025-04-16T04:19:36Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
+			name: "mid-priority pod preempts low-priority pod at the beginning, but could not find candidates after the nominated node is deleted",
+			// Create a taint node to simulate the `UnschedulableAndUnresolvable` condition in `findCandidates` during preemption.
+			initNodes: []*v1.Node{
+				st.MakeNode().Name("taint-node").Capacity(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).
+					Taints([]v1.Taint{
+						{
+							Key:    "taint-node",
+							Value:  "true",
+							Effect: v1.TaintEffectNoSchedule,
+						},
+					}).
+					Obj(),
+			},
+			nodeCapacity: map[v1.ResourceName]string{v1.ResourceCPU: "1"},
+			podsToCreate: [][]*v1.Pod{
+				{
+					st.MakePod().Name("low").Priority(lowPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+				{
+					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+			},
+			postChecks: []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error{
+				testutils.WaitForPodToSchedule,
+				testutils.WaitForNominatedNodeName,
+				testutils.WaitForPodUnschedulable,
path: test/integration/scheduler/preemption/preemption_test.go
user: login: macsko
body: You should remove `testutils.WaitForPodUnschedulable` check from here. It won't be executed anyway, because we have 2 `podsToCreate` entries. 
created_at: 2025-04-16T09:18:32Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
+			name: "mid-priority pod preempts low-priority pod at the beginning, but could not find candidates after the nominated node is deleted",
+			// Create a taint node to simulate the `UnschedulableAndUnresolvable` condition in `findCandidates` during preemption.
+			initNodes: []*v1.Node{
+				st.MakeNode().Name("taint-node").Capacity(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).
+					Taints([]v1.Taint{
+						{
+							Key:    "taint-node",
+							Value:  "true",
+							Effect: v1.TaintEffectNoSchedule,
+						},
+					}).
+					Obj(),
+			},
+			nodeCapacity: map[v1.ResourceName]string{v1.ResourceCPU: "1"},
+			podsToCreate: [][]*v1.Pod{
+				{
+					st.MakePod().Name("low").Priority(lowPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+				{
+					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+			},
+			postChecks: []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error{
+				testutils.WaitForPodToSchedule,
+				testutils.WaitForNominatedNodeName,
+				testutils.WaitForPodUnschedulable,
path: test/integration/scheduler/preemption/preemption_test.go
user: login: haosdent
body: Thanks, have removed.
created_at: 2025-04-16T09:24:31Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: Well, right..
created_at: 2025-04-16T09:49:56Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,39 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
+			name: "mid-priority pod preempts low-priority pod at the beginning, but could not find candidates after the nominated node is deleted",
+			// Create a taint node to simulate the `UnschedulableAndUnresolvable` condition in `findCandidates` during preemption.
+			initNodes: []*v1.Node{
+				st.MakeNode().Name("taint-node").Capacity(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).
+					Taints([]v1.Taint{
+						{
+							Key:    "taint-node",
+							Value:  "true",
+							Effect: v1.TaintEffectNoSchedule,
+						},
+					}).
+					Obj(),
+			},
+			nodeCapacity: map[v1.ResourceName]string{v1.ResourceCPU: "1"},
+			podsToCreate: [][]*v1.Pod{
+				{
+					st.MakePod().Name("low").Priority(lowPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+				{
+					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+			},
+			postChecks: []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error{
+				testutils.WaitForPodToSchedule,
+				testutils.WaitForNominatedNodeName,
+			},
+			// Delete the fake node to trigger the `UnschedulableAndUnresolvable` condition in `findCandidates`.
+			deleteFakeNode:   true,
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: I think this test case expects:
1. low pod is preempted by medium pod
2. node is deleted
3. medium pod is retried (low pod's Pod/Delete event trigger requeueing)
4. because node is already deleted and the other node is tainted, medium pod, again, gets unschedulable
5. the preemption fails this time because of the taint, and we remove the nominated node name.

But, what if the scheduler receives the node deletion after the medium pod's second scheduling cycle starts? 
1. low pod is preempted
6. medium pod is retried (low pod's Pod/Delete event trigger requeueing)
7. medium pod just goes to the node before the node is deleted.

Doesn't this test case result in flake like this?
created_at: 2025-04-16T09:56:24Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,39 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
+			name: "mid-priority pod preempts low-priority pod at the beginning, but could not find candidates after the nominated node is deleted",
+			// Create a taint node to simulate the `UnschedulableAndUnresolvable` condition in `findCandidates` during preemption.
+			initNodes: []*v1.Node{
+				st.MakeNode().Name("taint-node").Capacity(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).
+					Taints([]v1.Taint{
+						{
+							Key:    "taint-node",
+							Value:  "true",
+							Effect: v1.TaintEffectNoSchedule,
+						},
+					}).
+					Obj(),
+			},
+			nodeCapacity: map[v1.ResourceName]string{v1.ResourceCPU: "1"},
+			podsToCreate: [][]*v1.Pod{
+				{
+					st.MakePod().Name("low").Priority(lowPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+				{
+					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+			},
+			postChecks: []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error{
+				testutils.WaitForPodToSchedule,
+				testutils.WaitForNominatedNodeName,
+			},
+			// Delete the fake node to trigger the `UnschedulableAndUnresolvable` condition in `findCandidates`.
+			deleteFakeNode:   true,
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: Ah, I just noticed `podNamesToDelete: []string{"low"},`. So, looks like the low pod wouldn't be deleted without force-delete. And, we do force-delete after deleting the node. Okay, that makes sense to prevent the above flake test concern.
created_at: 2025-04-16T10:02:43Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,40 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: I now agree that the current commit's test is the simplest for this reason. Let's go with that.
created_at: 2025-04-16T10:03:43Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,39 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
+			name: "mid-priority pod preempts low-priority pod at the beginning, but could not find candidates after the nominated node is deleted",
+			// Create a taint node to simulate the `UnschedulableAndUnresolvable` condition in `findCandidates` during preemption.
+			initNodes: []*v1.Node{
+				st.MakeNode().Name("taint-node").Capacity(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).
+					Taints([]v1.Taint{
+						{
+							Key:    "taint-node",
+							Value:  "true",
+							Effect: v1.TaintEffectNoSchedule,
+						},
+					}).
+					Obj(),
+			},
+			nodeCapacity: map[v1.ResourceName]string{v1.ResourceCPU: "1"},
+			podsToCreate: [][]*v1.Pod{
+				{
+					st.MakePod().Name("low").Priority(lowPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+				{
+					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+			},
+			postChecks: []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error{
+				testutils.WaitForPodToSchedule,
+				testutils.WaitForNominatedNodeName,
+			},
+			// Delete the fake node to trigger the `UnschedulableAndUnresolvable` condition in `findCandidates`.
+			deleteFakeNode:   true,
path: test/integration/scheduler/preemption/preemption_test.go
user: login: haosdent
body: > medium pod just goes to the node before the node is deleted.

I use the following test case to try, butit  seems would not happen even if I remove `deleteFakeNode` and `podNamesToDelete`

```
		{
			name:         "test case",
			nodeCapacity: map[v1.ResourceName]string{v1.ResourceCPU: "1"},
			podsToCreate: [][]*v1.Pod{
				{
					st.MakePod().Name("low").Priority(lowPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
				},
				{
					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
				},
			},
			postChecks: []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error{
				testutils.WaitForPodToSchedule,
				testutils.WaitForPodToSchedule,
			},
```

The above test case always fails because it cannot wait for the medium to become `scheduled`

What I saw from the log is that it just triggers the preemption instead of assigning the medium pod to the node.
```
eventhandlers.go:162: I0416 18:44:09.957109] Update event for unscheduled pod pod="preemption5aaa8e39-0af1-4e08-b7bb-94f5a5c08a9a/medium"
...
I0416 18:44:09.965112   89327 preemption.go:541] "Async Preemption finished completely" preemptor="preemption5aaa8e39-0af1-4e08-b7bb-94f5a5c08a9a/medium" node="fake-node" result="success"
```

```
	logger.V(4).Info("Update event for unscheduled pod", "pod", klog.KObj(newPod))
	sched.SchedulingQueue.Update(logger, oldPod, newPod)
	if hasNominatedNodeNameChanged(oldPod, newPod) {
		// Nominated node changed in pod, so we need to treat it as if the pod was deleted from the old nominated node,
		// because the scheduler treats such a pod as if it was already assigned when scheduling lower or equal priority pods.
		sched.SchedulingQueue.MoveAllToActiveOrBackoffQueue(logger, framework.EventAssignedPodDelete, oldPod, nil, getLEPriorityPreCheck(corev1helpers.PodPriority(oldPod)))
	}
```
created_at: 2025-04-16T11:13:46Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,39 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
+			name: "mid-priority pod preempts low-priority pod at the beginning, but could not find candidates after the nominated node is deleted",
+			// Create a taint node to simulate the `UnschedulableAndUnresolvable` condition in `findCandidates` during preemption.
+			initNodes: []*v1.Node{
+				st.MakeNode().Name("taint-node").Capacity(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).
+					Taints([]v1.Taint{
+						{
+							Key:    "taint-node",
+							Value:  "true",
+							Effect: v1.TaintEffectNoSchedule,
+						},
+					}).
+					Obj(),
+			},
+			nodeCapacity: map[v1.ResourceName]string{v1.ResourceCPU: "1"},
+			podsToCreate: [][]*v1.Pod{
+				{
+					st.MakePod().Name("low").Priority(lowPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+				{
+					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+			},
+			postChecks: []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error{
+				testutils.WaitForPodToSchedule,
+				testutils.WaitForNominatedNodeName,
+			},
+			// Delete the fake node to trigger the `UnschedulableAndUnresolvable` condition in `findCandidates`.
+			deleteFakeNode:   true,
path: test/integration/scheduler/preemption/preemption_test.go
user: login: haosdent
body: Or how about I make prebind always fail to avoid such flaky scenario, although I could not reproduce it?

```
			customPlugins: &configv1.Plugins{
				PreBind: configv1.PluginSet{
					Enabled: []configv1.Plugin{
						{Name: alwaysFailPlugin},
					},
				},
			},
```
created_at: 2025-04-16T11:36:49Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,39 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
+			name: "mid-priority pod preempts low-priority pod at the beginning, but could not find candidates after the nominated node is deleted",
+			// Create a taint node to simulate the `UnschedulableAndUnresolvable` condition in `findCandidates` during preemption.
+			initNodes: []*v1.Node{
+				st.MakeNode().Name("taint-node").Capacity(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).
+					Taints([]v1.Taint{
+						{
+							Key:    "taint-node",
+							Value:  "true",
+							Effect: v1.TaintEffectNoSchedule,
+						},
+					}).
+					Obj(),
+			},
+			nodeCapacity: map[v1.ResourceName]string{v1.ResourceCPU: "1"},
+			podsToCreate: [][]*v1.Pod{
+				{
+					st.MakePod().Name("low").Priority(lowPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+				{
+					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+			},
+			postChecks: []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error{
+				testutils.WaitForPodToSchedule,
+				testutils.WaitForNominatedNodeName,
+			},
+			// Delete the fake node to trigger the `UnschedulableAndUnresolvable` condition in `findCandidates`.
+			deleteFakeNode:   true,
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: I mean, I think the current test case implementation is ok.
created_at: 2025-04-17T10:43:14Z
author_association: MEMBER
diff_hunk: @@ -1600,8 +1602,39 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 				testutils.WaitForPodToSchedule,
 				testutils.WaitForNominatedNodeName,
 			},
-			// Delete the node to simulate an ErrNoNodesAvailable error.
-			deleteNode:       true,
+			// Delete the fake node to simulate an ErrNoNodesAvailable error.
+			deleteFakeNode:   true,
+			podNamesToDelete: []string{"low"},
+		},
+		{
+			name: "mid-priority pod preempts low-priority pod at the beginning, but could not find candidates after the nominated node is deleted",
+			// Create a taint node to simulate the `UnschedulableAndUnresolvable` condition in `findCandidates` during preemption.
+			initNodes: []*v1.Node{
+				st.MakeNode().Name("taint-node").Capacity(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).
+					Taints([]v1.Taint{
+						{
+							Key:    "taint-node",
+							Value:  "true",
+							Effect: v1.TaintEffectNoSchedule,
+						},
+					}).
+					Obj(),
+			},
+			nodeCapacity: map[v1.ResourceName]string{v1.ResourceCPU: "1"},
+			podsToCreate: [][]*v1.Pod{
+				{
+					st.MakePod().Name("low").Priority(lowPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+				{
+					st.MakePod().Name("medium").Priority(mediumPriority).Req(map[v1.ResourceName]string{v1.ResourceCPU: "1"}).Obj(),
+				},
+			},
+			postChecks: []func(ctx context.Context, cs clientset.Interface, pod *v1.Pod) error{
+				testutils.WaitForPodToSchedule,
+				testutils.WaitForNominatedNodeName,
+			},
+			// Delete the fake node to trigger the `UnschedulableAndUnresolvable` condition in `findCandidates`.
+			deleteFakeNode:   true,
path: test/integration/scheduler/preemption/preemption_test.go
user: login: sanposhiho
body: So, I put /lgtm :)
created_at: 2025-04-17T10:43:32Z
author_association: MEMBER

PR comments:
user: login: k8s-ci-robot
created_at: 2025-04-13T15:50:42Z
body: Please note that we're already in [Test Freeze](https://github.com/kubernetes/sig-release/blob/master/releases/release_phases.md#test-freeze) for the `release-1.33` branch. This means every merged PR will be automatically fast-forwarded via the periodic [ci-fast-forward](https://testgrid.k8s.io/sig-release-releng-blocking#git-repo-kubernetes-fast-forward) job to the release branch of the upcoming v1.33.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Sun Apr 13 13:30:23 UTC 2025.

author_association: CONTRIBUTOR
user: login: k8s-ci-robot
created_at: 2025-04-13T15:50:44Z
body: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the `triage/accepted` label and provide further guidance.

The `triage/accepted` label can be added by org members by writing `/triage accepted` in a comment.


<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
</details>
author_association: CONTRIBUTOR
user: login: haosdent
created_at: 2025-04-13T15:52:34Z
body: /ok-to-test
author_association: MEMBER
user: login: haosdent
created_at: 2025-04-13T15:53:01Z
body: /sig scheduling

author_association: MEMBER
user: login: sanposhiho
created_at: 2025-04-13T22:22:47Z
body: /sig scheduling
/kind cleanup
author_association: MEMBER
user: login: sanposhiho
created_at: 2025-04-13T22:23:31Z
body: Can we have (or do we have) tests to ensure that the nominated node name is cleaned up correctly in this scenario?
author_association: MEMBER
user: login: haosdent
created_at: 2025-04-15T09:34:23Z
body: @sanposhiho Does this test case enough to verify the scenario you mentioned?

https://github.com/kubernetes/kubernetes/blob/30469e180361d7da07b0fee6d47c776fa2cf3e86/test/integration/scheduler/preemption/preemption_test.go#L1567-L1586

The `"medium"` pod would set the `.status.nominatedNode` at the beginning but would be clean after the `"high"` pod was scheduled.

author_association: MEMBER
user: login: sanposhiho
created_at: 2025-04-15T10:25:44Z
body: > The "medium" pod would set the .status.nominatedNode at the beginning but would be clean after the "high" pod was scheduled.

Looks like it's not the scenario you changed in this PR. We have to check the pod with the nominated node name would be handled by the preemption, but no candidate is found, and then the existing nominated node name is removed from it.
author_association: MEMBER
user: login: haosdent
created_at: 2025-04-15T10:46:39Z
body: > Looks like it's not the scenario you changed in this PR. We have to check the pod with the nominated node name would be handled by the preemption, but no candidate is found, and then the existing nominated node name is removed from it.

@sanposhiho  Understood, I just added another one in `TestNominatedNodeCleanUp`

And here is my local run result 

```
...
    preemption.go:317: I0415 18:32:48.455864] PostFilter/DefaultPreemption: Preemption will not help schedule pod on any node pod="preemption9bb41605-a264-4510-a497-3747502f9d00/medium"
...
```
which matches the log at `findCandidates` method
https://github.com/kubernetes/kubernetes/blob/30469e180361d7da07b0fee6d47c776fa2cf3e86/pkg/scheduler/framework/preemption/preemption.go#L306-L317

```
...
    schedule_one.go:1044: I0415 18:32:48.456054] Unable to schedule pod; no fit; waiting pod="preemption9bb41605-a264-4510-a497-3747502f9d00/medium" err="0/1 nodes are available: 1 node(s) had untolerated taint {taint-node: true}. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling."
..
```
which matches the log at `handleSchedulingFailure` method https://github.com/kubernetes/kubernetes/blob/30469e180361d7da07b0fee6d47c776fa2cf3e86/pkg/scheduler/schedule_one.go#L1011-L1044
author_association: MEMBER
user: login: k8s-ci-robot
created_at: 2025-04-16T10:04:42Z
body: LGTM label has been added.  <details>Git tree hash: b76fbb5aa7c4077106e792628437b71a1a00b4f2</details>
author_association: CONTRIBUTOR
user: login: sanposhiho
created_at: 2025-04-17T10:44:12Z
body: @haosdent You need to add `NONE` to your release note section to remove `do-not-merge/release-note-label-needed` label. Your another PR as well.
author_association: MEMBER
user: login: haosdent
created_at: 2025-04-17T10:46:19Z
body: Done, thanks @sanposhiho 
author_association: MEMBER
user: login: macsko
created_at: 2025-04-17T14:18:07Z
body: /approve
author_association: MEMBER
user: login: k8s-ci-robot
created_at: 2025-04-17T14:18:21Z
body: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes/kubernetes/pull/131278#" title="Author self-approved">haosdent</a>*, *<a href="https://github.com/kubernetes/kubernetes/pull/131278#issuecomment-2813102180" title="Approved">macsko</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes%2Fkubernetes).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[pkg/scheduler/OWNERS](https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/OWNERS)~~ [macsko]
- ~~[test/integration/scheduler/OWNERS](https://github.com/kubernetes/kubernetes/blob/master/test/integration/scheduler/OWNERS)~~ [macsko]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
author_association: CONTRIBUTOR
user: login: k8s-ci-robot
created_at: 2025-04-24T00:48:42Z
body: @haosdent: The following test **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-kubernetes-e2e-kind-ipv6 | ac3274521bebf606dd7a78c380943475fb39aa0c | [link](https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/131278/pull-kubernetes-e2e-kind-ipv6/1915197116297252864) | unknown | `/test pull-kubernetes-e2e-kind-ipv6`

[Full PR test history](https://prow.k8s.io/pr-history?org=kubernetes&repo=kubernetes&pr=131278). [Your PR dashboard](https://prow.k8s.io/pr?query=is%3Apr%20state%3Aopen%20author%3Ahaosdent). Please help us cut down on flakes by [linking to](https://git.k8s.io/community/contributors/devel/sig-testing/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/kubernetes/kubernetes/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
author_association: CONTRIBUTOR
user: login: pacoxu
created_at: 2025-04-24T00:49:59Z
body: /test pull-kubernetes-e2e-kind-ipv6
author_association: MEMBER