@@ -254,6 +254,27 @@ func TestCoreResourceEnqueue(t *testing.T) {
254
254
wantRequeuedPods : sets .New ("pod2" ),
255
255
enableSchedulingQueueHint : []bool {false , true },
256
256
},
257
+ {
258
+ name : "Pod rejected by the NodeAffinity plugin is requeued when a Node is updated" ,
259
+ initialNodes : []* v1.Node {st .MakeNode ().Name ("fake-node1" ).Label ("group" , "a" ).Obj ()},
260
+ pods : []* v1.Pod {
261
+ // - Pod1 will be rejected by the NodeAffinity plugin.
262
+ st .MakePod ().Name ("pod1" ).NodeAffinityIn ("group" , []string {"b" }).Container ("image" ).Obj (),
263
+ // - Pod2 will be rejected by the NodeAffinity plugin.
264
+ st .MakePod ().Name ("pod2" ).NodeAffinityIn ("group" , []string {"c" }).Container ("image" ).Obj (),
265
+ },
266
+ triggerFn : func (testCtx * testutils.TestContext ) error {
267
+ // Trigger a NodeUpdate event to change label.
268
+ // It causes pod1 to be requeued.
269
+ // It causes pod2 not to be requeued.
270
+ if _ , err := testCtx .ClientSet .CoreV1 ().Nodes ().Update (testCtx .Ctx , st .MakeNode ().Name ("fake-node1" ).Label ("group" , "b" ).Obj (), metav1.UpdateOptions {}); err != nil {
271
+ return fmt .Errorf ("failed to remove taints off the node: %w" , err )
272
+ }
273
+ return nil
274
+ },
275
+ wantRequeuedPods : sets .New ("pod1" ),
276
+ enableSchedulingQueueHint : []bool {false , true },
277
+ },
257
278
{
258
279
name : "Pod updated with toleration requeued to activeQ" ,
259
280
initialNodes : []* v1.Node {st .MakeNode ().Name ("fake-node" ).Capacity (map [v1.ResourceName ]string {v1 .ResourceCPU : "2" }).Taints ([]v1.Taint {{Key : "taint-key" , Effect : v1 .TaintEffectNoSchedule }}).Obj ()},
0 commit comments