e2e create pods only on schedulable nodes

We were avoiding the scheduled using the pod.Spec.NodeName directly,
however, once we switched to using the node selector, the no_snat
e2e test started to fail because was trying to schedule pods on
nodes with taints, hence, failing the test.
This commit is contained in:
Antonio Ojea 2021-04-17 12:05:31 +02:00
parent d090d17cb5
commit 0695bc45cf

View File

@ -28,6 +28,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/kubernetes/test/e2e/framework"
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
"k8s.io/kubernetes/test/e2e/network/common"
imageutils "k8s.io/kubernetes/test/utils/image"
@ -65,10 +66,9 @@ var _ = common.SIGDescribe("NoSNAT [Feature:NoSNAT] [Slow]", func() {
ginkgo.It("Should be able to send traffic between Pods without SNAT", func() {
cs := f.ClientSet
pc := cs.CoreV1().Pods(f.Namespace.Name)
nc := cs.CoreV1().Nodes()
ginkgo.By("creating a test pod on each Node")
nodes, err := nc.List(context.TODO(), metav1.ListOptions{})
nodes, err := e2enode.GetReadySchedulableNodes(cs)
framework.ExpectNoError(err)
framework.ExpectNotEqual(len(nodes.Items), 0, "no Nodes in the cluster")