mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
add e2e test for services with hostNetwork endpoints
we are missing tests that check the connectivity against services that have backend pods with hostNetwork: true. Because the tests run in parallel, it is possible that the pods used as backends try to bind to the same port, and since all of them use the host network, the scheduler will fail to create them due to port conflicts, so we run them serially. We have to skip networking tests with udp and endpoints using hostNetwork, because they have a known issue.
This commit is contained in:
parent
734d5bbed0
commit
b61faa388c
@ -434,6 +434,78 @@ var _ = SIGDescribe("Networking", func() {
|
||||
framework.Failf("failed dialing endpoint, %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
// skip because pods can not reach the endpoint in the same host if using UDP and hostNetwork
|
||||
// xref: #95565
|
||||
ginkgo.It("should function for pod-Service(hostNetwork): udp", func() {
|
||||
e2eskipper.Skipf("skip because pods can not reach the endpoint in the same host if using UDP and hostNetwork #95565")
|
||||
config := e2enetwork.NewNetworkingTestConfig(f, e2enetwork.EndpointsUseHostNetwork)
|
||||
ginkgo.By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, e2enetwork.ClusterUDPPort))
|
||||
err := config.DialFromTestContainer("udp", config.ClusterIP, e2enetwork.ClusterUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||
if err != nil {
|
||||
framework.Failf("failed dialing endpoint, %v", err)
|
||||
}
|
||||
|
||||
ginkgo.By(fmt.Sprintf("dialing(udp) %v --> %v:%v (nodeIP)", config.TestContainerPod.Name, config.NodeIP, config.NodeUDPPort))
|
||||
err = config.DialFromTestContainer("udp", config.NodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||
if err != nil {
|
||||
framework.Failf("failed dialing endpoint, %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
// if the endpoints pods use hostNetwork, several tests can't run in parallel
|
||||
// because the pods will try to acquire the same port in the host.
|
||||
// We run the test in serial, to avoid port conflicts.
|
||||
ginkgo.It("should function for service endpoints using hostNetwork", func() {
|
||||
config := e2enetwork.NewNetworkingTestConfig(f, e2enetwork.UseHostNetwork, e2enetwork.EndpointsUseHostNetwork)
|
||||
|
||||
ginkgo.By("pod-Service(hostNetwork): http")
|
||||
|
||||
ginkgo.By(fmt.Sprintf("dialing(http) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, e2enetwork.ClusterHTTPPort))
|
||||
err := config.DialFromTestContainer("http", config.ClusterIP, e2enetwork.ClusterHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||
if err != nil {
|
||||
framework.Failf("failed dialing endpoint, %v", err)
|
||||
}
|
||||
ginkgo.By(fmt.Sprintf("dialing(http) %v --> %v:%v (nodeIP)", config.TestContainerPod.Name, config.NodeIP, config.NodeHTTPPort))
|
||||
err = config.DialFromTestContainer("http", config.NodeIP, config.NodeHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||
if err != nil {
|
||||
framework.Failf("failed dialing endpoint, %v", err)
|
||||
}
|
||||
|
||||
ginkgo.By("node-Service(hostNetwork): http")
|
||||
|
||||
ginkgo.By(fmt.Sprintf("dialing(http) %v (node) --> %v:%v (config.clusterIP)", config.NodeIP, config.ClusterIP, e2enetwork.ClusterHTTPPort))
|
||||
config.DialFromNode("http", config.ClusterIP, e2enetwork.ClusterHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||
ginkgo.By(fmt.Sprintf("dialing(http) %v (node) --> %v:%v (nodeIP)", config.NodeIP, config.NodeIP, config.NodeHTTPPort))
|
||||
config.DialFromNode("http", config.NodeIP, config.NodeHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||
|
||||
ginkgo.By("node-Service(hostNetwork): udp")
|
||||
|
||||
ginkgo.By(fmt.Sprintf("dialing(udp) %v (node) --> %v:%v (config.clusterIP)", config.NodeIP, config.ClusterIP, e2enetwork.ClusterUDPPort))
|
||||
config.DialFromNode("udp", config.ClusterIP, e2enetwork.ClusterUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||
ginkgo.By(fmt.Sprintf("dialing(udp) %v (node) --> %v:%v (nodeIP)", config.NodeIP, config.NodeIP, config.NodeUDPPort))
|
||||
config.DialFromNode("udp", config.NodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||
|
||||
ginkgo.By("handle large requests: http(hostNetwork)")
|
||||
|
||||
ginkgo.By(fmt.Sprintf("dialing(http) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, e2enetwork.ClusterHTTPPort))
|
||||
message := strings.Repeat("42", 1000)
|
||||
err = config.DialEchoFromTestContainer("http", config.ClusterIP, e2enetwork.ClusterHTTPPort, config.MaxTries, 0, message)
|
||||
if err != nil {
|
||||
framework.Failf("failed dialing endpoint, %v", err)
|
||||
}
|
||||
|
||||
ginkgo.By("handle large requests: udp(hostNetwork)")
|
||||
|
||||
ginkgo.By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, e2enetwork.ClusterUDPPort))
|
||||
message = "n" + strings.Repeat("o", 1999)
|
||||
err = config.DialEchoFromTestContainer("udp", config.ClusterIP, e2enetwork.ClusterUDPPort, config.MaxTries, 0, message)
|
||||
if err != nil {
|
||||
framework.Failf("failed dialing endpoint, %v", err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
// Once basic tests checking for the sctp module not to be loaded are implemented, this
|
||||
|
Loading…
Reference in New Issue
Block a user