mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #84090 from oomichi/move-LaunchHostExecPod
Move LaunchHostExecPod() to e2e network
This commit is contained in:
commit
ba4adeff20
@ -442,17 +442,6 @@ func NewExecPodSpec(ns, name string, hostNetwork bool) *v1.Pod {
|
|||||||
return 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
|
// newExecPodSpec returns the pod spec of exec pod
|
||||||
func newExecPodSpec(ns, generateName string) *v1.Pod {
|
func newExecPodSpec(ns, generateName string) *v1.Pod {
|
||||||
immediate := int64(0)
|
immediate := int64(0)
|
||||||
|
@ -1318,7 +1318,7 @@ var _ = SIGDescribe("Services", func() {
|
|||||||
err = t.DeleteService(serviceName)
|
err = t.DeleteService(serviceName)
|
||||||
framework.ExpectNoError(err, "failed to delete service: %s in namespace: %s", serviceName, ns)
|
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)
|
cmd := fmt.Sprintf(`! ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN`, nodePort)
|
||||||
var stdout string
|
var stdout string
|
||||||
if pollErr := wait.PollImmediate(framework.Poll, e2eservice.KubeProxyLagTimeout, func() (bool, error) {
|
if pollErr := wait.PollImmediate(framework.Poll, e2eservice.KubeProxyLagTimeout, func() (bool, error) {
|
||||||
@ -1624,7 +1624,7 @@ var _ = SIGDescribe("Services", func() {
|
|||||||
// a pod to test the service.
|
// a pod to test the service.
|
||||||
ginkgo.By("hitting the internal load balancer from pod")
|
ginkgo.By("hitting the internal load balancer from pod")
|
||||||
framework.Logf("creating pod with host network")
|
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)
|
framework.Logf("Waiting up to %v for service %q's internal LB to respond to requests", createTimeout, serviceName)
|
||||||
tcpIngressIP := e2eservice.GetIngressPoint(lbIngress)
|
tcpIngressIP := e2eservice.GetIngressPoint(lbIngress)
|
||||||
@ -2581,3 +2581,14 @@ func createPausePodDeployment(cs clientset.Interface, name, ns string, replicas
|
|||||||
framework.ExpectNoError(err, "Error in creating deployment for pause pod")
|
framework.ExpectNoError(err, "Error in creating deployment for pause pod")
|
||||||
return deployment
|
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
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user