Toleration priority function score computation

I think, if a pod doesn't have any tolerations, we don't prefer node without taints to
the one which has taints in https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/algorithm/priorities/taint_toleration.go#L29, so there is no point in testing that particular functionality. The side effect of the above is, since we're going round-robin in every scheduling cycle sometimes we're choosing first node and in the next cycle we'd move onto next node(where taints are not being applied), so it's causing problem unnecessarily
This commit is contained in:
ravisantoshgudimetla 2019-08-02 12:52:09 -07:00
parent 42d7feee28
commit 7c53ccfd68

View File

@ -221,31 +221,9 @@ var _ = SIGDescribe("SchedulerPriorities [Serial]", func() {
// make the nodes have balanced cpu,mem usage ratio
err := createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.5)
framework.ExpectNoError(err)
//we need apply more taints on a node, because one match toleration only count 1
ginkgo.By("Trying to apply 10 taint on the nodes except first one.")
// Apply 10 taints to first node
nodeName := nodeList.Items[0].Name
for index, node := range nodeList.Items {
if index == 0 {
continue
}
for i := 0; i < 10; i++ {
testTaint := addRandomTaitToNode(cs, node.Name)
defer framework.RemoveTaintOffNode(cs, node.Name, *testTaint)
}
}
ginkgo.By("Create a pod without any tolerations")
tolerationPodName := "without-tolerations"
pod := createPausePod(f, pausePodConfig{
Name: tolerationPodName,
})
framework.ExpectNoError(f.WaitForPodRunning(pod.Name))
ginkgo.By("Pod should prefer scheduled to the node don't have the taint.")
tolePod, err := cs.CoreV1().Pods(ns).Get(tolerationPodName, metav1.GetOptions{})
framework.ExpectNoError(err)
framework.ExpectEqual(tolePod.Spec.NodeName, nodeName)
ginkgo.By("Trying to apply 10 taint on the first node.")
var tolerations []v1.Toleration
for i := 0; i < 10; i++ {
@ -253,16 +231,16 @@ var _ = SIGDescribe("SchedulerPriorities [Serial]", func() {
tolerations = append(tolerations, v1.Toleration{Key: testTaint.Key, Value: testTaint.Value, Effect: testTaint.Effect})
defer framework.RemoveTaintOffNode(cs, nodeName, *testTaint)
}
tolerationPodName = "with-tolerations"
tolerationPodName := "with-tolerations"
ginkgo.By("Create a pod that tolerates all the taints of the first node.")
pod = createPausePod(f, pausePodConfig{
pod := createPausePod(f, pausePodConfig{
Name: tolerationPodName,
Tolerations: tolerations,
})
framework.ExpectNoError(f.WaitForPodRunning(pod.Name))
ginkgo.By("Pod should prefer scheduled to the node that pod can tolerate.")
tolePod, err = cs.CoreV1().Pods(ns).Get(tolerationPodName, metav1.GetOptions{})
tolePod, err := cs.CoreV1().Pods(ns).Get(tolerationPodName, metav1.GetOptions{})
framework.ExpectNoError(err)
framework.ExpectEqual(tolePod.Spec.NodeName, nodeName)
})