Skip to content

Commit 0bd6940

Browse files
authored
Merge pull request kubernetes#88556 from Huang-Wei/sched-e2e-flake-part2
Fix a scheduler e2e bug on Preemption
2 parents 8392baf + ef786c9 commit 0bd6940

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

test/e2e/scheduling/predicates.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,11 +836,15 @@ func initPausePod(f *framework.Framework, conf pausePodConfig) *v1.Pod {
836836
},
837837
},
838838
Tolerations: conf.Tolerations,
839-
NodeName: conf.NodeName,
840839
PriorityClassName: conf.PriorityClassName,
841840
TerminationGracePeriodSeconds: &gracePeriod,
842841
},
843842
}
843+
// TODO: setting the Pod's nodeAffinity instead of setting .spec.nodeName works around the
844+
// Preemption e2e flake (#88441), but we should investigate deeper to get to the bottom of it.
845+
if len(conf.NodeName) != 0 {
846+
e2epod.SetNodeAffinity(&pod.Spec, conf.NodeName)
847+
}
844848
if conf.Resources != nil {
845849
pod.Spec.Containers[0].Resources = *conf.Resources
846850
}

test/e2e/scheduling/preemption.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,14 @@ var _ = SIGDescribe("SchedulerPreemption [Serial]", func() {
214214
if len(pods) == 0 {
215215
priorityName = lowPriorityClassName
216216
}
217-
pods[i] = createPausePod(f, pausePodConfig{
217+
pods = append(pods, createPausePod(f, pausePodConfig{
218218
Name: fmt.Sprintf("pod%d-%v", i, priorityName),
219219
PriorityClassName: priorityName,
220220
Resources: &v1.ResourceRequirements{
221221
Requests: podRes,
222222
},
223223
NodeName: node.Name,
224-
})
224+
}))
225225
framework.Logf("Created pod: %v", pods[i].Name)
226226
}
227227
if len(pods) < 2 {

0 commit comments

Comments
 (0)