mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Solve race between scheduler and kubelet about new node labels
This commit is contained in:
parent
8e25b7c7bf
commit
d5aea32d07
@ -425,7 +425,13 @@ var _ = Describe("SchedulerPredicates", func() {
|
|||||||
})
|
})
|
||||||
expectNoError(err)
|
expectNoError(err)
|
||||||
defer c.Pods(ns).Delete(labelPodName, api.NewDeleteOptions(0))
|
defer c.Pods(ns).Delete(labelPodName, api.NewDeleteOptions(0))
|
||||||
expectNoError(waitForPodRunningInNamespace(c, labelPodName, ns))
|
|
||||||
|
// check that pod got scheduled. We intentionally DO NOT check that the
|
||||||
|
// pod is running because this will create a race condition with the
|
||||||
|
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
||||||
|
// already when the kubelet does not know about its new label yet. The
|
||||||
|
// kubelet will then refuse to launch the pod.
|
||||||
|
expectNoError(waitForPodNotPending(c, ns, labelPodName))
|
||||||
labelPod, err := c.Pods(ns).Get(labelPodName)
|
labelPod, err := c.Pods(ns).Get(labelPodName)
|
||||||
expectNoError(err)
|
expectNoError(err)
|
||||||
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
||||||
|
Loading…
Reference in New Issue
Block a user