Code change:
framework.ExpectNotEqual(labelPod.Spec.NodeName, nodeName) }) <del> ginkgo.It("Pod should avoid nodes that have avoidPod annotation", func() { nodeName := nodeList.Items[0].Name // make the nodes have balanced cpu,mem usage cleanUp, err := createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.5) defer cleanUp() framework.ExpectNoError(err) ginkgo.By("Create a RC, with 0 replicas") rc := createRC(ns, "scheduler-priority-avoid-pod", int32(0), map[string]string{"name": "scheduler-priority-avoid-pod"}, f, podRequestedResource) // Cleanup the replication controller when we are done. defer func() { // Resize the replication controller to zero to get rid of pods. if err := e2erc.DeleteRCAndWaitForGC(f.ClientSet, f.Namespace.Name, rc.Name); err != nil { framework.Logf("Failed to cleanup replication controller %v: %v.", rc.Name, err) } }() ginkgo.By("Trying to apply avoidPod annotations on the first node.") avoidPod := v1.AvoidPods{ PreferAvoidPods: []v1.PreferAvoidPodsEntry{ { PodSignature: v1.PodSignature{ PodController: &metav1.OwnerReference{ APIVersion: "v1", Kind:       "ReplicationController", Name:       rc.Name, UID:        rc.UID, Controller: func() *bool { b := true; return &b }(), }, }, Reason:  "some reson", Message: "some message", }, }, } action := func() error { addOrUpdateAvoidPodOnNode(cs, nodeName, avoidPod) return nil } predicate := func(node *v1.Node) bool { val, err := json.Marshal(avoidPod) if err != nil { return false } return node.Annotations[v1.PreferAvoidPodsAnnotationKey] == string(val) } success, err := observeNodeUpdateAfterAction(f.ClientSet, nodeName, predicate, action) framework.ExpectNoError(err) framework.ExpectEqual(success, true) defer removeAvoidPodsOffNode(cs, nodeName) ginkgo.By(fmt.Sprintf("Scale the RC: %s to len(nodeList.Item)-1 : %v.", rc.Name, len(nodeList.Items)-1)) e2erc.ScaleRC(f.ClientSet, f.ScalesGetter, ns, rc.Name, uint(len(nodeList.Items)-1), true) testPods, err := cs.CoreV1().Pods(ns).List(context.TODO(), metav1.ListOptions{ LabelSelector: "name=scheduler-priority-avoid-pod", }) framework.ExpectNoError(err) ginkgo.By(fmt.Sprintf("Verify the pods should not scheduled to the node: %s", nodeName)) for _, pod := range testPods.Items { framework.ExpectNotEqual(pod.Spec.NodeName, nodeName) } }) </del> ginkgo.It("Pod should be preferably scheduled to nodes pod can tolerate", func() { // make the nodes have balanced cpu,mem usage ratio cleanUp, err := createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.5)

Related discussion:
text: <!-- Please only use this template for submitting reports about continuously failing tests or jobs in Kubernetes CI --ci-kubernetes-e2e-gci-gce-serial (gce-cos-master-serial) Kubernetes e2e suite.[sig-scheduling] SchedulerPriorities [Serial] Pod should avoid nodes that have avoidPod annotation June 19th 2021 () Testgrid: https://k8s- Prow history: Looks like pods are scheduled where they shouldn't be? : The tests passes in maybe 20% of the builds, but it looks random, so I don't treat it as a flake. At the moment there are also sig-storage tests consistently failing in this job: , They don't look related though. /sig scheduling /kind failing-test
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/milestone v1.22
try to have a look.
try to have a look.
/cc
This is expected. The feature (which was alpha) is now disabled by default. Users can still enable it by switching to a v1beta1 scheduler component config. Let's remove the test.