Merge pull request #29000 from gmarek/taint

Automatic merge from submit-queue

Defer taint removal in SchedulerPredictes

cc @davidopp @kevin-wangzefeng
pull/6/head
k8s-merge-robot 2016-07-15 06:23:01 -07:00 committed by GitHub
commit 186c0c7b14
1 changed files with 18 additions and 16 deletions

View File

@ -1367,6 +1367,15 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
taintValue := "testing-taint-value"
taintEffect := string(api.TaintEffectNoSchedule)
framework.RunKubectlOrDie("taint", "nodes", nodeName, taintName+"="+taintValue+":"+taintEffect)
defer func() {
By("removing the taint " + taintName + " off the node " + nodeName)
framework.RunKubectlOrDie("taint", "nodes", nodeName, taintName+"-")
By("verifying the node doesn't have the taint " + taintName)
output := framework.RunKubectlOrDie("describe", "node", nodeName)
if strings.Contains(output, taintName) {
framework.Failf("Failed removing taint " + taintName + " of the node " + nodeName)
}
}()
By("verifying the node has the taint " + taintName + " with the value " + taintValue)
output := framework.RunKubectlOrDie("describe", "node", nodeName)
requiredStrings := [][]string{
@ -1431,14 +1440,6 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
deployedPod, err := c.Pods(ns).Get(tolerationPodName)
framework.ExpectNoError(err)
Expect(deployedPod.Spec.NodeName).To(Equal(nodeName))
By("removing the taint " + taintName + " off the node " + nodeName)
framework.RunKubectlOrDie("taint", "nodes", nodeName, taintName+"-")
By("verifying the node doesn't have the taint " + taintName)
output = framework.RunKubectlOrDie("describe", "node", nodeName)
if strings.Contains(output, taintName) {
framework.Failf("Failed removing taint " + taintName + " of the node " + nodeName)
}
})
// 1. Run a pod to get an available node, then delete the pod
@ -1482,6 +1483,15 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
taintValue := "testing-taint-value"
taintEffect := string(api.TaintEffectNoSchedule)
framework.RunKubectlOrDie("taint", "nodes", nodeName, taintName+"="+taintValue+":"+taintEffect)
defer func() {
By("removing the taint " + taintName + " off the node " + nodeName)
framework.RunKubectlOrDie("taint", "nodes", nodeName, taintName+"-")
By("verifying the node doesn't have the taint " + taintName)
output := framework.RunKubectlOrDie("describe", "node", nodeName)
if strings.Contains(output, taintName) {
framework.Failf("Failed removing taint " + taintName + " of the node " + nodeName)
}
}()
By("verifying the node has the taint " + taintName + " with the value " + taintValue)
output := framework.RunKubectlOrDie("describe", "node", nodeName)
requiredStrings := [][]string{
@ -1534,14 +1544,6 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
verifyResult(c, podNameNoTolerations, ns)
cleanupPods(c, ns)
By("removing the taint " + taintName + " off the node " + nodeName)
framework.RunKubectlOrDie("taint", "nodes", nodeName, taintName+"-")
By("verifying the node doesn't have the taint " + taintName)
output = framework.RunKubectlOrDie("describe", "node", nodeName)
if strings.Contains(output, taintName) {
framework.Failf("Failed removing taint " + taintName + " of the node " + nodeName)
}
By("Trying to relaunch the same.")
_, err = c.Pods(ns).Create(&podNoTolerations)
framework.ExpectNoError(err)