Merge pull request #88556 from Huang-Wei/sched-e2e-flake-part2

Fix a scheduler e2e bug on Preemption
This commit is contained in:
Kubernetes Prow Robot 2020-02-27 16:12:39 -08:00 committed by GitHub
commit 0bd694033a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -836,11 +836,15 @@ func initPausePod(f *framework.Framework, conf pausePodConfig) *v1.Pod {
}, },
}, },
Tolerations: conf.Tolerations, Tolerations: conf.Tolerations,
NodeName: conf.NodeName,
PriorityClassName: conf.PriorityClassName, PriorityClassName: conf.PriorityClassName,
TerminationGracePeriodSeconds: &gracePeriod, TerminationGracePeriodSeconds: &gracePeriod,
}, },
} }
// TODO: setting the Pod's nodeAffinity instead of setting .spec.nodeName works around the
// Preemption e2e flake (#88441), but we should investigate deeper to get to the bottom of it.
if len(conf.NodeName) != 0 {
e2epod.SetNodeAffinity(&pod.Spec, conf.NodeName)
}
if conf.Resources != nil { if conf.Resources != nil {
pod.Spec.Containers[0].Resources = *conf.Resources pod.Spec.Containers[0].Resources = *conf.Resources
} }

View File

@ -214,14 +214,14 @@ var _ = SIGDescribe("SchedulerPreemption [Serial]", func() {
if len(pods) == 0 { if len(pods) == 0 {
priorityName = lowPriorityClassName priorityName = lowPriorityClassName
} }
pods[i] = createPausePod(f, pausePodConfig{ pods = append(pods, createPausePod(f, pausePodConfig{
Name: fmt.Sprintf("pod%d-%v", i, priorityName), Name: fmt.Sprintf("pod%d-%v", i, priorityName),
PriorityClassName: priorityName, PriorityClassName: priorityName,
Resources: &v1.ResourceRequirements{ Resources: &v1.ResourceRequirements{
Requests: podRes, Requests: podRes,
}, },
NodeName: node.Name, NodeName: node.Name,
}) }))
framework.Logf("Created pod: %v", pods[i].Name) framework.Logf("Created pod: %v", pods[i].Name)
} }
if len(pods) < 2 { if len(pods) < 2 {