From 0695bc45cf168f33fcfb53db4d443f70ec9b5d05 Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Sat, 17 Apr 2021 12:05:31 +0200 Subject: [PATCH] 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. --- test/e2e/network/no_snat.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/network/no_snat.go b/test/e2e/network/no_snat.go index a53d77b4608..1799914cfff 100644 --- a/test/e2e/network/no_snat.go +++ b/test/e2e/network/no_snat.go @@ -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")