Unverified Commit f8d37cda authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #61920 from resouer/fix-61916

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Add namespace name into e2e event verify function **What this PR does / why we need it**: Scheduler now events assigned msg with `ns/podname`, but the e2e is still expect `podname` only. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #61916 **Special notes for your reviewer**: cc @Random-Liu @bsalamat @kubernetes/sig-scheduling-pr-reviews **Release note**: ```release-note NONE ```
parents 99fd98a8 b6464675
......@@ -91,7 +91,7 @@ var _ = framework.KubeDescribe("EquivalenceCache [Serial]", func() {
WaitForSchedulerAfterAction(f, func() error {
err := CreateNodeSelectorPods(f, rcName, 2, nodeSelector, false)
return err
}, rcName, false)
}, ns, rcName, false)
defer framework.DeleteRCAndPods(f.ClientSet, f.InternalClientset, f.ScalesGetter, ns, rcName)
// the first replica pod is scheduled, and the second pod will be rejected.
verifyResult(cs, 1, 1, ns)
......@@ -157,7 +157,7 @@ var _ = framework.KubeDescribe("EquivalenceCache [Serial]", func() {
WaitForSchedulerAfterAction(f, func() error {
err := framework.ScaleRC(f.ClientSet, f.InternalClientset, f.ScalesGetter, ns, affinityRCName, uint(replica+1), false)
return err
}, affinityRCName, false)
}, ns, affinityRCName, false)
// and this new pod should be rejected since node label has been updated
verifyReplicasResult(cs, replica, 1, ns, affinityRCName)
})
......@@ -222,7 +222,7 @@ var _ = framework.KubeDescribe("EquivalenceCache [Serial]", func() {
WaitForSchedulerAfterAction(f, func() error {
_, err := cs.CoreV1().ReplicationControllers(ns).Create(rc)
return err
}, labelRCName, false)
}, ns, labelRCName, false)
// these two replicas should all be rejected since podAntiAffinity says it they anit-affinity with pod {"service": "S1"}
verifyReplicasResult(cs, 0, replica, ns, labelRCName)
......
......@@ -23,12 +23,12 @@ import (
"k8s.io/api/core/v1"
)
func scheduleSuccessEvent(podName, nodeName string) func(*v1.Event) bool {
func scheduleSuccessEvent(ns, podName, nodeName string) func(*v1.Event) bool {
return func(e *v1.Event) bool {
return e.Type == v1.EventTypeNormal &&
e.Reason == "Scheduled" &&
strings.HasPrefix(e.Name, podName) &&
strings.Contains(e.Message, fmt.Sprintf("Successfully assigned %v to %v", podName, nodeName))
strings.Contains(e.Message, fmt.Sprintf("Successfully assigned %v/%v to %v", ns, podName, nodeName))
}
}
......
......@@ -147,7 +147,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
WaitForSchedulerAfterAction(f, createPausePodAction(f, pausePodConfig{
Name: podName,
Labels: map[string]string{"name": "additional"},
}), podName, false)
}), ns, podName, false)
verifyResult(cs, podsNeededForSaturation, 1, ns)
})
......@@ -222,7 +222,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
},
},
}
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), podName, false)
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)
verifyResult(cs, podsNeededForSaturation, 1, ns)
})
......@@ -337,7 +337,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
},
},
}
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), podName, false)
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)
verifyResult(cs, len(fillerPods), 1, ns)
})
......@@ -362,7 +362,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
},
}
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), podName, false)
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)
verifyResult(cs, 0, 1, ns)
})
......@@ -461,7 +461,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
},
Labels: map[string]string{"name": "restricted"},
}
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), podName, false)
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)
verifyResult(cs, 0, 1, ns)
})
......@@ -585,11 +585,11 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
NodeSelector: map[string]string{labelKey: labelValue},
}
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), podNameNoTolerations, false)
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podNameNoTolerations, false)
verifyResult(cs, 0, 1, ns)
By("Removing taint off the node")
WaitForSchedulerAfterAction(f, removeTaintFromNodeAction(cs, nodeName, testTaint), podNameNoTolerations, true)
WaitForSchedulerAfterAction(f, removeTaintFromNodeAction(cs, nodeName, testTaint), ns, podNameNoTolerations, true)
verifyResult(cs, 1, 0, ns)
})
......@@ -736,10 +736,10 @@ func createPausePodAction(f *framework.Framework, conf pausePodConfig) common.Ac
// WaitForSchedulerAfterAction performs the provided action and then waits for
// scheduler to act on the given pod.
func WaitForSchedulerAfterAction(f *framework.Framework, action common.Action, podName string, expectSuccess bool) {
func WaitForSchedulerAfterAction(f *framework.Framework, action common.Action, ns, podName string, expectSuccess bool) {
predicate := scheduleFailureEvent(podName)
if expectSuccess {
predicate = scheduleSuccessEvent(podName, "" /* any node */)
predicate = scheduleSuccessEvent(ns, podName, "" /* any node */)
}
success, err := common.ObserveEventAfterAction(f, predicate, action)
Expect(err).NotTo(HaveOccurred())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment