Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move LaunchHostExecPod() to e2e network #84090

Merged
merged 1 commit into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 0 additions & 11 deletions test/e2e/framework/pod/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,17 +442,6 @@ func NewExecPodSpec(ns, name string, hostNetwork bool) *v1.Pod {
return pod
}

// LaunchHostExecPod launches a hostexec pod in the given namespace and waits
// until it's Running
func LaunchHostExecPod(client clientset.Interface, ns, name string) *v1.Pod {
hostExecPod := NewExecPodSpec(ns, name, true)
pod, err := client.CoreV1().Pods(ns).Create(hostExecPod)
expectNoError(err)
err = WaitForPodRunningInNamespace(client, pod)
expectNoError(err)
return pod
}

// newExecPodSpec returns the pod spec of exec pod
func newExecPodSpec(ns, generateName string) *v1.Pod {
immediate := int64(0)
Expand Down
15 changes: 13 additions & 2 deletions test/e2e/network/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ var _ = SIGDescribe("Services", func() {
err = t.DeleteService(serviceName)
framework.ExpectNoError(err, "failed to delete service: %s in namespace: %s", serviceName, ns)

hostExec := e2epod.LaunchHostExecPod(f.ClientSet, f.Namespace.Name, "hostexec")
hostExec := launchHostExecPod(f.ClientSet, f.Namespace.Name, "hostexec")
cmd := fmt.Sprintf(`! ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN`, nodePort)
var stdout string
if pollErr := wait.PollImmediate(framework.Poll, e2eservice.KubeProxyLagTimeout, func() (bool, error) {
Expand Down Expand Up @@ -1610,7 +1610,7 @@ var _ = SIGDescribe("Services", func() {
// a pod to test the service.
ginkgo.By("hitting the internal load balancer from pod")
framework.Logf("creating pod with host network")
hostExec := e2epod.LaunchHostExecPod(f.ClientSet, f.Namespace.Name, "ilb-host-exec")
hostExec := launchHostExecPod(f.ClientSet, f.Namespace.Name, "ilb-host-exec")

framework.Logf("Waiting up to %v for service %q's internal LB to respond to requests", createTimeout, serviceName)
tcpIngressIP := e2eservice.GetIngressPoint(lbIngress)
Expand Down Expand Up @@ -2545,3 +2545,14 @@ func createPausePodDeployment(cs clientset.Interface, name, ns string, replicas
framework.ExpectNoError(err, "Error in creating deployment for pause pod")
return deployment
}

// launchHostExecPod launches a hostexec pod in the given namespace and waits
// until it's Running
func launchHostExecPod(client clientset.Interface, ns, name string) *v1.Pod {
hostExecPod := e2epod.NewExecPodSpec(ns, name, true)
pod, err := client.CoreV1().Pods(ns).Create(hostExecPod)
framework.ExpectNoError(err)
err = e2epod.WaitForPodRunningInNamespace(client, pod)
framework.ExpectNoError(err)
return pod
}