mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #75860 from oomichi/golint-e2e-framework-n
Fix golint failures of e2e/framework/n*.go
This commit is contained in:
commit
789818794f
@ -40,7 +40,7 @@ var _ = Describe("[sig-network] Networking", func() {
|
|||||||
framework.ConformanceIt("should function for intra-pod communication: http [LinuxOnly] [NodeConformance]", func() {
|
framework.ConformanceIt("should function for intra-pod communication: http [LinuxOnly] [NodeConformance]", func() {
|
||||||
config := framework.NewCoreNetworkingTestConfig(f, true)
|
config := framework.NewCoreNetworkingTestConfig(f, true)
|
||||||
for _, endpointPod := range config.EndpointPods {
|
for _, endpointPod := range config.EndpointPods {
|
||||||
config.DialFromTestContainer("http", endpointPod.Status.PodIP, framework.EndpointHttpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
config.DialFromTestContainer("http", endpointPod.Status.PodIP, framework.EndpointHTTPPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ var _ = Describe("[sig-network] Networking", func() {
|
|||||||
framework.ConformanceIt("should function for intra-pod communication: udp [LinuxOnly] [NodeConformance]", func() {
|
framework.ConformanceIt("should function for intra-pod communication: udp [LinuxOnly] [NodeConformance]", func() {
|
||||||
config := framework.NewCoreNetworkingTestConfig(f, true)
|
config := framework.NewCoreNetworkingTestConfig(f, true)
|
||||||
for _, endpointPod := range config.EndpointPods {
|
for _, endpointPod := range config.EndpointPods {
|
||||||
config.DialFromTestContainer("udp", endpointPod.Status.PodIP, framework.EndpointUdpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
config.DialFromTestContainer("udp", endpointPod.Status.PodIP, framework.EndpointUDPPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ var _ = Describe("[sig-network] Networking", func() {
|
|||||||
framework.ConformanceIt("should function for node-pod communication: http [LinuxOnly] [NodeConformance]", func() {
|
framework.ConformanceIt("should function for node-pod communication: http [LinuxOnly] [NodeConformance]", func() {
|
||||||
config := framework.NewCoreNetworkingTestConfig(f, true)
|
config := framework.NewCoreNetworkingTestConfig(f, true)
|
||||||
for _, endpointPod := range config.EndpointPods {
|
for _, endpointPod := range config.EndpointPods {
|
||||||
config.DialFromNode("http", endpointPod.Status.PodIP, framework.EndpointHttpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
config.DialFromNode("http", endpointPod.Status.PodIP, framework.EndpointHTTPPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ var _ = Describe("[sig-network] Networking", func() {
|
|||||||
framework.ConformanceIt("should function for node-pod communication: udp [LinuxOnly] [NodeConformance]", func() {
|
framework.ConformanceIt("should function for node-pod communication: udp [LinuxOnly] [NodeConformance]", func() {
|
||||||
config := framework.NewCoreNetworkingTestConfig(f, true)
|
config := framework.NewCoreNetworkingTestConfig(f, true)
|
||||||
for _, endpointPod := range config.EndpointPods {
|
for _, endpointPod := range config.EndpointPods {
|
||||||
config.DialFromNode("udp", endpointPod.Status.PodIP, framework.EndpointUdpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
config.DialFromNode("udp", endpointPod.Status.PodIP, framework.EndpointUDPPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
@ -42,11 +42,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
EndpointHttpPort = 8080
|
// EndpointHTTPPort is an endpoint HTTP port for testing.
|
||||||
EndpointUdpPort = 8081
|
EndpointHTTPPort = 8080
|
||||||
TestContainerHttpPort = 8080
|
// EndpointUDPPort is an endpoint UDP port for testing.
|
||||||
ClusterHttpPort = 80
|
EndpointUDPPort = 8081
|
||||||
ClusterUdpPort = 90
|
testContainerHTTPPort = 8080
|
||||||
|
// ClusterHTTPPort is a cluster HTTP port for testing.
|
||||||
|
ClusterHTTPPort = 80
|
||||||
|
// ClusterUDPPort is a cluster UDP port for testing.
|
||||||
|
ClusterUDPPort = 90
|
||||||
testPodName = "test-container-pod"
|
testPodName = "test-container-pod"
|
||||||
hostTestPodName = "host-test-container-pod"
|
hostTestPodName = "host-test-container-pod"
|
||||||
nodePortServiceName = "node-port-service"
|
nodePortServiceName = "node-port-service"
|
||||||
@ -59,30 +63,30 @@ const (
|
|||||||
testTries = 30
|
testTries = 30
|
||||||
// Maximum number of pods in a test, to make test work in large clusters.
|
// Maximum number of pods in a test, to make test work in large clusters.
|
||||||
maxNetProxyPodsCount = 10
|
maxNetProxyPodsCount = 10
|
||||||
// Number of checks to hit a given set of endpoints when enable session affinity.
|
// SessionAffinityChecks is number of checks to hit a given set of endpoints when enable session affinity.
|
||||||
SessionAffinityChecks = 10
|
SessionAffinityChecks = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
var NetexecImageName = imageutils.GetE2EImage(imageutils.Netexec)
|
var netexecImageName = imageutils.GetE2EImage(imageutils.Netexec)
|
||||||
|
|
||||||
// NewNetworkingTestConfig creates and sets up a new test config helper.
|
// NewNetworkingTestConfig creates and sets up a new test config helper.
|
||||||
func NewNetworkingTestConfig(f *Framework) *NetworkingTestConfig {
|
func NewNetworkingTestConfig(f *Framework) *NetworkingTestConfig {
|
||||||
config := &NetworkingTestConfig{f: f, Namespace: f.Namespace.Name, HostNetwork: true}
|
config := &NetworkingTestConfig{f: f, Namespace: f.Namespace.Name, HostNetwork: true}
|
||||||
By(fmt.Sprintf("Performing setup for networking test in namespace %v", config.Namespace))
|
ginkgo.By(fmt.Sprintf("Performing setup for networking test in namespace %v", config.Namespace))
|
||||||
config.setup(getServiceSelector())
|
config.setup(getServiceSelector())
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewNetworkingTestNodeE2EConfig creates and sets up a new test config helper for Node E2E.
|
// NewCoreNetworkingTestConfig creates and sets up a new test config helper for Node E2E.
|
||||||
func NewCoreNetworkingTestConfig(f *Framework, hostNetwork bool) *NetworkingTestConfig {
|
func NewCoreNetworkingTestConfig(f *Framework, hostNetwork bool) *NetworkingTestConfig {
|
||||||
config := &NetworkingTestConfig{f: f, Namespace: f.Namespace.Name, HostNetwork: hostNetwork}
|
config := &NetworkingTestConfig{f: f, Namespace: f.Namespace.Name, HostNetwork: hostNetwork}
|
||||||
By(fmt.Sprintf("Performing setup for networking test in namespace %v", config.Namespace))
|
ginkgo.By(fmt.Sprintf("Performing setup for networking test in namespace %v", config.Namespace))
|
||||||
config.setupCore(getServiceSelector())
|
config.setupCore(getServiceSelector())
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
func getServiceSelector() map[string]string {
|
func getServiceSelector() map[string]string {
|
||||||
By("creating a selector")
|
ginkgo.By("creating a selector")
|
||||||
selectorName := "selector-" + string(uuid.NewUUID())
|
selectorName := "selector-" + string(uuid.NewUUID())
|
||||||
serviceSelector := map[string]string{
|
serviceSelector := map[string]string{
|
||||||
selectorName: "true",
|
selectorName: "true",
|
||||||
@ -124,19 +128,21 @@ type NetworkingTestConfig struct {
|
|||||||
// External ip of first node for use in nodePort testing.
|
// External ip of first node for use in nodePort testing.
|
||||||
NodeIP string
|
NodeIP string
|
||||||
// The http/udp nodePorts of the Service.
|
// The http/udp nodePorts of the Service.
|
||||||
NodeHttpPort int
|
NodeHTTPPort int
|
||||||
NodeUdpPort int
|
NodeUDPPort int
|
||||||
// The kubernetes namespace within which all resources for this
|
// The kubernetes namespace within which all resources for this
|
||||||
// config are created
|
// config are created
|
||||||
Namespace string
|
Namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DialFromEndpointContainer executes a curl via kubectl exec in an endpoint container.
|
||||||
func (config *NetworkingTestConfig) DialFromEndpointContainer(protocol, targetIP string, targetPort, maxTries, minTries int, expectedEps sets.String) {
|
func (config *NetworkingTestConfig) DialFromEndpointContainer(protocol, targetIP string, targetPort, maxTries, minTries int, expectedEps sets.String) {
|
||||||
config.DialFromContainer(protocol, config.EndpointPods[0].Status.PodIP, targetIP, EndpointHttpPort, targetPort, maxTries, minTries, expectedEps)
|
config.DialFromContainer(protocol, config.EndpointPods[0].Status.PodIP, targetIP, EndpointHTTPPort, targetPort, maxTries, minTries, expectedEps)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DialFromTestContainer executes a curl via kubectl exec in a test container.
|
||||||
func (config *NetworkingTestConfig) DialFromTestContainer(protocol, targetIP string, targetPort, maxTries, minTries int, expectedEps sets.String) {
|
func (config *NetworkingTestConfig) DialFromTestContainer(protocol, targetIP string, targetPort, maxTries, minTries int, expectedEps sets.String) {
|
||||||
config.DialFromContainer(protocol, config.TestContainerPod.Status.PodIP, targetIP, TestContainerHttpPort, targetPort, maxTries, minTries, expectedEps)
|
config.DialFromContainer(protocol, config.TestContainerPod.Status.PodIP, targetIP, testContainerHTTPPort, targetPort, maxTries, minTries, expectedEps)
|
||||||
}
|
}
|
||||||
|
|
||||||
// diagnoseMissingEndpoints prints debug information about the endpoints that
|
// diagnoseMissingEndpoints prints debug information about the endpoints that
|
||||||
@ -163,7 +169,7 @@ func (config *NetworkingTestConfig) EndpointHostnames() sets.String {
|
|||||||
return expectedEps
|
return expectedEps
|
||||||
}
|
}
|
||||||
|
|
||||||
// DialFromContainers executes a curl via kubectl exec in a test container,
|
// DialFromContainer executes a curl via kubectl exec in a test container,
|
||||||
// which might then translate to a tcp or udp request based on the protocol
|
// which might then translate to a tcp or udp request based on the protocol
|
||||||
// argument in the url.
|
// argument in the url.
|
||||||
// - minTries is the minimum number of curl attempts required before declaring
|
// - minTries is the minimum number of curl attempts required before declaring
|
||||||
@ -176,8 +182,8 @@ func (config *NetworkingTestConfig) EndpointHostnames() sets.String {
|
|||||||
// maxTries == minTries will confirm that we see the expected endpoints and no
|
// maxTries == minTries will confirm that we see the expected endpoints and no
|
||||||
// more for maxTries. Use this if you want to eg: fail a readiness check on a
|
// more for maxTries. Use this if you want to eg: fail a readiness check on a
|
||||||
// pod and confirm it doesn't show up as an endpoint.
|
// pod and confirm it doesn't show up as an endpoint.
|
||||||
func (config *NetworkingTestConfig) DialFromContainer(protocol, containerIP, targetIP string, containerHttpPort, targetPort, maxTries, minTries int, expectedEps sets.String) {
|
func (config *NetworkingTestConfig) DialFromContainer(protocol, containerIP, targetIP string, containerHTTPPort, targetPort, maxTries, minTries int, expectedEps sets.String) {
|
||||||
ipPort := net.JoinHostPort(containerIP, strconv.Itoa(containerHttpPort))
|
ipPort := net.JoinHostPort(containerIP, strconv.Itoa(containerHTTPPort))
|
||||||
// The current versions of curl included in CentOS and RHEL distros
|
// The current versions of curl included in CentOS and RHEL distros
|
||||||
// misinterpret square brackets around IPv6 as globbing, so use the -g
|
// misinterpret square brackets around IPv6 as globbing, so use the -g
|
||||||
// argument to disable globbing to handle the IPv6 case.
|
// argument to disable globbing to handle the IPv6 case.
|
||||||
@ -225,8 +231,9 @@ func (config *NetworkingTestConfig) DialFromContainer(protocol, containerIP, tar
|
|||||||
Failf("Failed to find expected endpoints:\nTries %d\nCommand %v\nretrieved %v\nexpected %v\n", maxTries, cmd, eps, expectedEps)
|
Failf("Failed to find expected endpoints:\nTries %d\nCommand %v\nretrieved %v\nexpected %v\n", maxTries, cmd, eps, expectedEps)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetEndpointsFromTestContainer executes a curl via kubectl exec in a test container.
|
||||||
func (config *NetworkingTestConfig) GetEndpointsFromTestContainer(protocol, targetIP string, targetPort, tries int) (sets.String, error) {
|
func (config *NetworkingTestConfig) GetEndpointsFromTestContainer(protocol, targetIP string, targetPort, tries int) (sets.String, error) {
|
||||||
return config.GetEndpointsFromContainer(protocol, config.TestContainerPod.Status.PodIP, targetIP, TestContainerHttpPort, targetPort, tries)
|
return config.GetEndpointsFromContainer(protocol, config.TestContainerPod.Status.PodIP, targetIP, testContainerHTTPPort, targetPort, tries)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetEndpointsFromContainer executes a curl via kubectl exec in a test container,
|
// GetEndpointsFromContainer executes a curl via kubectl exec in a test container,
|
||||||
@ -234,8 +241,8 @@ func (config *NetworkingTestConfig) GetEndpointsFromTestContainer(protocol, targ
|
|||||||
// in the url. It returns all different endpoints from multiple retries.
|
// in the url. It returns all different endpoints from multiple retries.
|
||||||
// - tries is the number of curl attempts. If this many attempts pass and
|
// - tries is the number of curl attempts. If this many attempts pass and
|
||||||
// we don't see any endpoints, the test fails.
|
// we don't see any endpoints, the test fails.
|
||||||
func (config *NetworkingTestConfig) GetEndpointsFromContainer(protocol, containerIP, targetIP string, containerHttpPort, targetPort, tries int) (sets.String, error) {
|
func (config *NetworkingTestConfig) GetEndpointsFromContainer(protocol, containerIP, targetIP string, containerHTTPPort, targetPort, tries int) (sets.String, error) {
|
||||||
ipPort := net.JoinHostPort(containerIP, strconv.Itoa(containerHttpPort))
|
ipPort := net.JoinHostPort(containerIP, strconv.Itoa(containerHTTPPort))
|
||||||
// The current versions of curl included in CentOS and RHEL distros
|
// The current versions of curl included in CentOS and RHEL distros
|
||||||
// misinterpret square brackets around IPv6 as globbing, so use the -g
|
// misinterpret square brackets around IPv6 as globbing, so use the -g
|
||||||
// argument to disable globbing to handle the IPv6 case.
|
// argument to disable globbing to handle the IPv6 case.
|
||||||
@ -341,17 +348,17 @@ func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targ
|
|||||||
// doesn't match the expected string.
|
// doesn't match the expected string.
|
||||||
func (config *NetworkingTestConfig) GetSelfURL(port int32, path string, expected string) {
|
func (config *NetworkingTestConfig) GetSelfURL(port int32, path string, expected string) {
|
||||||
cmd := fmt.Sprintf("curl -i -q -s --connect-timeout 1 http://localhost:%d%s", port, path)
|
cmd := fmt.Sprintf("curl -i -q -s --connect-timeout 1 http://localhost:%d%s", port, path)
|
||||||
By(fmt.Sprintf("Getting kube-proxy self URL %s", path))
|
ginkgo.By(fmt.Sprintf("Getting kube-proxy self URL %s", path))
|
||||||
config.executeCurlCmd(cmd, expected)
|
config.executeCurlCmd(cmd, expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSelfStatusCode executes a curl against the given path via kubectl exec into a
|
// GetSelfURLStatusCode executes a curl against the given path via kubectl exec into a
|
||||||
// test container running with host networking, and fails if the returned status
|
// test container running with host networking, and fails if the returned status
|
||||||
// code doesn't match the expected string.
|
// code doesn't match the expected string.
|
||||||
func (config *NetworkingTestConfig) GetSelfURLStatusCode(port int32, path string, expected string) {
|
func (config *NetworkingTestConfig) GetSelfURLStatusCode(port int32, path string, expected string) {
|
||||||
// check status code
|
// check status code
|
||||||
cmd := fmt.Sprintf("curl -o /dev/null -i -q -s -w %%{http_code} --connect-timeout 1 http://localhost:%d%s", port, path)
|
cmd := fmt.Sprintf("curl -o /dev/null -i -q -s -w %%{http_code} --connect-timeout 1 http://localhost:%d%s", port, path)
|
||||||
By(fmt.Sprintf("Checking status code against http://localhost:%d%s", port, path))
|
ginkgo.By(fmt.Sprintf("Checking status code against http://localhost:%d%s", port, path))
|
||||||
config.executeCurlCmd(cmd, expected)
|
config.executeCurlCmd(cmd, expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +401,7 @@ func (config *NetworkingTestConfig) createNetShellPodSpec(podName, hostname stri
|
|||||||
Handler: v1.Handler{
|
Handler: v1.Handler{
|
||||||
HTTPGet: &v1.HTTPGetAction{
|
HTTPGet: &v1.HTTPGetAction{
|
||||||
Path: "/healthz",
|
Path: "/healthz",
|
||||||
Port: intstr.IntOrString{IntVal: EndpointHttpPort},
|
Port: intstr.IntOrString{IntVal: EndpointHTTPPort},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -411,21 +418,21 @@ func (config *NetworkingTestConfig) createNetShellPodSpec(podName, hostname stri
|
|||||||
Containers: []v1.Container{
|
Containers: []v1.Container{
|
||||||
{
|
{
|
||||||
Name: "webserver",
|
Name: "webserver",
|
||||||
Image: NetexecImageName,
|
Image: netexecImageName,
|
||||||
ImagePullPolicy: v1.PullIfNotPresent,
|
ImagePullPolicy: v1.PullIfNotPresent,
|
||||||
Command: []string{
|
Command: []string{
|
||||||
"/netexec",
|
"/netexec",
|
||||||
fmt.Sprintf("--http-port=%d", EndpointHttpPort),
|
fmt.Sprintf("--http-port=%d", EndpointHTTPPort),
|
||||||
fmt.Sprintf("--udp-port=%d", EndpointUdpPort),
|
fmt.Sprintf("--udp-port=%d", EndpointUDPPort),
|
||||||
},
|
},
|
||||||
Ports: []v1.ContainerPort{
|
Ports: []v1.ContainerPort{
|
||||||
{
|
{
|
||||||
Name: "http",
|
Name: "http",
|
||||||
ContainerPort: EndpointHttpPort,
|
ContainerPort: EndpointHTTPPort,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "udp",
|
Name: "udp",
|
||||||
ContainerPort: EndpointUdpPort,
|
ContainerPort: EndpointUDPPort,
|
||||||
Protocol: v1.ProtocolUDP,
|
Protocol: v1.ProtocolUDP,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -455,17 +462,17 @@ func (config *NetworkingTestConfig) createTestPodSpec() *v1.Pod {
|
|||||||
Containers: []v1.Container{
|
Containers: []v1.Container{
|
||||||
{
|
{
|
||||||
Name: "webserver",
|
Name: "webserver",
|
||||||
Image: NetexecImageName,
|
Image: netexecImageName,
|
||||||
ImagePullPolicy: v1.PullIfNotPresent,
|
ImagePullPolicy: v1.PullIfNotPresent,
|
||||||
Command: []string{
|
Command: []string{
|
||||||
"/netexec",
|
"/netexec",
|
||||||
fmt.Sprintf("--http-port=%d", EndpointHttpPort),
|
fmt.Sprintf("--http-port=%d", EndpointHTTPPort),
|
||||||
fmt.Sprintf("--udp-port=%d", EndpointUdpPort),
|
fmt.Sprintf("--udp-port=%d", EndpointUDPPort),
|
||||||
},
|
},
|
||||||
Ports: []v1.ContainerPort{
|
Ports: []v1.ContainerPort{
|
||||||
{
|
{
|
||||||
Name: "http",
|
Name: "http",
|
||||||
ContainerPort: TestContainerHttpPort,
|
ContainerPort: testContainerHTTPPort,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -487,8 +494,8 @@ func (config *NetworkingTestConfig) createNodePortServiceSpec(svcName string, se
|
|||||||
Spec: v1.ServiceSpec{
|
Spec: v1.ServiceSpec{
|
||||||
Type: v1.ServiceTypeNodePort,
|
Type: v1.ServiceTypeNodePort,
|
||||||
Ports: []v1.ServicePort{
|
Ports: []v1.ServicePort{
|
||||||
{Port: ClusterHttpPort, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(EndpointHttpPort)},
|
{Port: ClusterHTTPPort, Name: "http", Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(EndpointHTTPPort)},
|
||||||
{Port: ClusterUdpPort, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt(EndpointUdpPort)},
|
{Port: ClusterUDPPort, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt(EndpointUDPPort)},
|
||||||
},
|
},
|
||||||
Selector: selector,
|
Selector: selector,
|
||||||
SessionAffinity: sessionAffinity,
|
SessionAffinity: sessionAffinity,
|
||||||
@ -504,6 +511,7 @@ func (config *NetworkingTestConfig) createSessionAffinityService(selector map[st
|
|||||||
config.SessionAffinityService = config.createService(config.createNodePortServiceSpec(sessionAffinityServiceName, selector, true))
|
config.SessionAffinityService = config.createService(config.createNodePortServiceSpec(sessionAffinityServiceName, selector, true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteNodePortService deletes NodePort service.
|
||||||
func (config *NetworkingTestConfig) DeleteNodePortService() {
|
func (config *NetworkingTestConfig) DeleteNodePortService() {
|
||||||
err := config.getServiceClient().Delete(config.NodePortService.Name, nil)
|
err := config.getServiceClient().Delete(config.NodePortService.Name, nil)
|
||||||
ExpectNoError(err, "error while deleting NodePortService. err:%v)", err)
|
ExpectNoError(err, "error while deleting NodePortService. err:%v)", err)
|
||||||
@ -548,11 +556,11 @@ func (config *NetworkingTestConfig) createService(serviceSpec *v1.Service) *v1.S
|
|||||||
// setupCore sets up the pods and core test config
|
// setupCore sets up the pods and core test config
|
||||||
// mainly for simplified node e2e setup
|
// mainly for simplified node e2e setup
|
||||||
func (config *NetworkingTestConfig) setupCore(selector map[string]string) {
|
func (config *NetworkingTestConfig) setupCore(selector map[string]string) {
|
||||||
By("Creating the service pods in kubernetes")
|
ginkgo.By("Creating the service pods in kubernetes")
|
||||||
podName := "netserver"
|
podName := "netserver"
|
||||||
config.EndpointPods = config.createNetProxyPods(podName, selector)
|
config.EndpointPods = config.createNetProxyPods(podName, selector)
|
||||||
|
|
||||||
By("Creating test pods")
|
ginkgo.By("Creating test pods")
|
||||||
config.createTestPods()
|
config.createTestPods()
|
||||||
|
|
||||||
epCount := len(config.EndpointPods)
|
epCount := len(config.EndpointPods)
|
||||||
@ -563,7 +571,7 @@ func (config *NetworkingTestConfig) setupCore(selector map[string]string) {
|
|||||||
func (config *NetworkingTestConfig) setup(selector map[string]string) {
|
func (config *NetworkingTestConfig) setup(selector map[string]string) {
|
||||||
config.setupCore(selector)
|
config.setupCore(selector)
|
||||||
|
|
||||||
By("Getting node addresses")
|
ginkgo.By("Getting node addresses")
|
||||||
ExpectNoError(WaitForAllNodesSchedulable(config.f.ClientSet, 10*time.Minute))
|
ExpectNoError(WaitForAllNodesSchedulable(config.f.ClientSet, 10*time.Minute))
|
||||||
nodeList := GetReadySchedulableNodesOrDie(config.f.ClientSet)
|
nodeList := GetReadySchedulableNodesOrDie(config.f.ClientSet)
|
||||||
config.ExternalAddrs = NodeAddresses(nodeList, v1.NodeExternalIP)
|
config.ExternalAddrs = NodeAddresses(nodeList, v1.NodeExternalIP)
|
||||||
@ -571,16 +579,16 @@ func (config *NetworkingTestConfig) setup(selector map[string]string) {
|
|||||||
SkipUnlessNodeCountIsAtLeast(2)
|
SkipUnlessNodeCountIsAtLeast(2)
|
||||||
config.Nodes = nodeList.Items
|
config.Nodes = nodeList.Items
|
||||||
|
|
||||||
By("Creating the service on top of the pods in kubernetes")
|
ginkgo.By("Creating the service on top of the pods in kubernetes")
|
||||||
config.createNodePortService(selector)
|
config.createNodePortService(selector)
|
||||||
config.createSessionAffinityService(selector)
|
config.createSessionAffinityService(selector)
|
||||||
|
|
||||||
for _, p := range config.NodePortService.Spec.Ports {
|
for _, p := range config.NodePortService.Spec.Ports {
|
||||||
switch p.Protocol {
|
switch p.Protocol {
|
||||||
case v1.ProtocolUDP:
|
case v1.ProtocolUDP:
|
||||||
config.NodeUdpPort = int(p.NodePort)
|
config.NodeUDPPort = int(p.NodePort)
|
||||||
case v1.ProtocolTCP:
|
case v1.ProtocolTCP:
|
||||||
config.NodeHttpPort = int(p.NodePort)
|
config.NodeHTTPPort = int(p.NodePort)
|
||||||
default:
|
default:
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -652,6 +660,7 @@ func (config *NetworkingTestConfig) createNetProxyPods(podName string, selector
|
|||||||
return runningPods
|
return runningPods
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteNetProxyPod deletes the first endpoint pod and waits for it being removed.
|
||||||
func (config *NetworkingTestConfig) DeleteNetProxyPod() {
|
func (config *NetworkingTestConfig) DeleteNetProxyPod() {
|
||||||
pod := config.EndpointPods[0]
|
pod := config.EndpointPods[0]
|
||||||
config.getPodClient().Delete(pod.Name, metav1.NewDeleteOptions(0))
|
config.getPodClient().Delete(pod.Name, metav1.NewDeleteOptions(0))
|
||||||
@ -689,6 +698,7 @@ func (config *NetworkingTestConfig) getNamespacesClient() coreclientset.Namespac
|
|||||||
return config.f.ClientSet.CoreV1().Namespaces()
|
return config.f.ClientSet.CoreV1().Namespaces()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckReachabilityFromPod checks reachability from the specified pod.
|
||||||
func CheckReachabilityFromPod(expectToBeReachable bool, timeout time.Duration, namespace, pod, target string) {
|
func CheckReachabilityFromPod(expectToBeReachable bool, timeout time.Duration, namespace, pod, target string) {
|
||||||
cmd := fmt.Sprintf("wget -T 5 -qO- %q", target)
|
cmd := fmt.Sprintf("wget -T 5 -qO- %q", target)
|
||||||
err := wait.PollImmediate(Poll, timeout, func() (bool, error) {
|
err := wait.PollImmediate(Poll, timeout, func() (bool, error) {
|
||||||
@ -707,6 +717,7 @@ func CheckReachabilityFromPod(expectToBeReachable bool, timeout time.Duration, n
|
|||||||
ExpectNoError(err)
|
ExpectNoError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HTTPPokeParams is a struct for HTTP poke parameters.
|
||||||
type HTTPPokeParams struct {
|
type HTTPPokeParams struct {
|
||||||
Timeout time.Duration
|
Timeout time.Duration
|
||||||
ExpectCode int // default = 200
|
ExpectCode int // default = 200
|
||||||
@ -714,6 +725,7 @@ type HTTPPokeParams struct {
|
|||||||
RetriableCodes []int
|
RetriableCodes []int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HTTPPokeResult is a struct for HTTP poke result.
|
||||||
type HTTPPokeResult struct {
|
type HTTPPokeResult struct {
|
||||||
Status HTTPPokeStatus
|
Status HTTPPokeStatus
|
||||||
Code int // HTTP code: 0 if the connection was not made
|
Code int // HTTP code: 0 if the connection was not made
|
||||||
@ -721,17 +733,25 @@ type HTTPPokeResult struct {
|
|||||||
Body []byte // if code != 0
|
Body []byte // if code != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HTTPPokeStatus is string for representing HTTP poke status.
|
||||||
type HTTPPokeStatus string
|
type HTTPPokeStatus string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// HTTPSuccess is HTTP poke status which is success.
|
||||||
HTTPSuccess HTTPPokeStatus = "Success"
|
HTTPSuccess HTTPPokeStatus = "Success"
|
||||||
HTTPError HTTPPokeStatus = "UnknownError"
|
// HTTPError is HTTP poke status which is error.
|
||||||
// Any time we add new errors, we should audit all callers of this.
|
HTTPError HTTPPokeStatus = "UnknownError"
|
||||||
HTTPTimeout HTTPPokeStatus = "TimedOut"
|
// HTTPTimeout is HTTP poke status which is timeout.
|
||||||
HTTPRefused HTTPPokeStatus = "ConnectionRefused"
|
HTTPTimeout HTTPPokeStatus = "TimedOut"
|
||||||
HTTPRetryCode HTTPPokeStatus = "RetryCode"
|
// HTTPRefused is HTTP poke status which is connection refused.
|
||||||
HTTPWrongCode HTTPPokeStatus = "WrongCode"
|
HTTPRefused HTTPPokeStatus = "ConnectionRefused"
|
||||||
|
// HTTPRetryCode is HTTP poke status which is retry code.
|
||||||
|
HTTPRetryCode HTTPPokeStatus = "RetryCode"
|
||||||
|
// HTTPWrongCode is HTTP poke status which is wrong code.
|
||||||
|
HTTPWrongCode HTTPPokeStatus = "WrongCode"
|
||||||
|
// HTTPBadResponse is HTTP poke status which is bad response.
|
||||||
HTTPBadResponse HTTPPokeStatus = "BadResponse"
|
HTTPBadResponse HTTPPokeStatus = "BadResponse"
|
||||||
|
// Any time we add new errors, we should audit all callers of this.
|
||||||
)
|
)
|
||||||
|
|
||||||
// PokeHTTP tries to connect to a host on a port for a given URL path. Callers
|
// PokeHTTP tries to connect to a host on a port for a given URL path. Callers
|
||||||
@ -844,26 +864,34 @@ func httpGetNoConnectionPoolTimeout(url string, timeout time.Duration) (*http.Re
|
|||||||
return client.Get(url)
|
return client.Get(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UDPPokeParams is a struct for UDP poke parameters.
|
||||||
type UDPPokeParams struct {
|
type UDPPokeParams struct {
|
||||||
Timeout time.Duration
|
Timeout time.Duration
|
||||||
Response string
|
Response string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UDPPokeResult is a struct for UDP poke result.
|
||||||
type UDPPokeResult struct {
|
type UDPPokeResult struct {
|
||||||
Status UDPPokeStatus
|
Status UDPPokeStatus
|
||||||
Error error // if there was any error
|
Error error // if there was any error
|
||||||
Response []byte // if code != 0
|
Response []byte // if code != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UDPPokeStatus is string for representing UDP poke status.
|
||||||
type UDPPokeStatus string
|
type UDPPokeStatus string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// UDPSuccess is UDP poke status which is success.
|
||||||
UDPSuccess UDPPokeStatus = "Success"
|
UDPSuccess UDPPokeStatus = "Success"
|
||||||
UDPError UDPPokeStatus = "UnknownError"
|
// UDPError is UDP poke status which is error.
|
||||||
// Any time we add new errors, we should audit all callers of this.
|
UDPError UDPPokeStatus = "UnknownError"
|
||||||
UDPTimeout UDPPokeStatus = "TimedOut"
|
// UDPTimeout is UDP poke status which is timeout.
|
||||||
UDPRefused UDPPokeStatus = "ConnectionRefused"
|
UDPTimeout UDPPokeStatus = "TimedOut"
|
||||||
|
// UDPRefused is UDP poke status which is connection refused.
|
||||||
|
UDPRefused UDPPokeStatus = "ConnectionRefused"
|
||||||
|
// UDPBadResponse is UDP poke status which is bad response.
|
||||||
UDPBadResponse UDPPokeStatus = "BadResponse"
|
UDPBadResponse UDPPokeStatus = "BadResponse"
|
||||||
|
// Any time we add new errors, we should audit all callers of this.
|
||||||
)
|
)
|
||||||
|
|
||||||
// PokeUDP tries to connect to a host on a port and send the given request. Callers
|
// PokeUDP tries to connect to a host on a port and send the given request. Callers
|
||||||
@ -937,7 +965,7 @@ func PokeUDP(host string, port int, request string, params *UDPPokeParams) UDPPo
|
|||||||
if bufsize == 0 {
|
if bufsize == 0 {
|
||||||
bufsize = 4096
|
bufsize = 4096
|
||||||
}
|
}
|
||||||
var buf []byte = make([]byte, bufsize)
|
var buf = make([]byte, bufsize)
|
||||||
n, err := con.Read(buf)
|
n, err := con.Read(buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ret.Error = err
|
ret.Error = err
|
||||||
@ -966,10 +994,12 @@ func PokeUDP(host string, port int, request string, params *UDPPokeParams) UDPPo
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestHitNodesFromOutside checkes HTTP connectivity from outside.
|
||||||
func TestHitNodesFromOutside(externalIP string, httpPort int32, timeout time.Duration, expectedHosts sets.String) error {
|
func TestHitNodesFromOutside(externalIP string, httpPort int32, timeout time.Duration, expectedHosts sets.String) error {
|
||||||
return TestHitNodesFromOutsideWithCount(externalIP, httpPort, timeout, expectedHosts, 1)
|
return TestHitNodesFromOutsideWithCount(externalIP, httpPort, timeout, expectedHosts, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestHitNodesFromOutsideWithCount checkes HTTP connectivity from outside with count.
|
||||||
func TestHitNodesFromOutsideWithCount(externalIP string, httpPort int32, timeout time.Duration, expectedHosts sets.String,
|
func TestHitNodesFromOutsideWithCount(externalIP string, httpPort int32, timeout time.Duration, expectedHosts sets.String,
|
||||||
countToSucceed int) error {
|
countToSucceed int) error {
|
||||||
Logf("Waiting up to %v for satisfying expectedHosts for %v times", timeout, countToSucceed)
|
Logf("Waiting up to %v for satisfying expectedHosts for %v times", timeout, countToSucceed)
|
||||||
@ -1007,7 +1037,7 @@ func TestHitNodesFromOutsideWithCount(externalIP string, httpPort int32, timeout
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blocks outgoing network traffic on 'node'. Then runs testFunc and returns its status.
|
// TestUnderTemporaryNetworkFailure blocks outgoing network traffic on 'node'. Then runs testFunc and returns its status.
|
||||||
// At the end (even in case of errors), the network traffic is brought back to normal.
|
// At the end (even in case of errors), the network traffic is brought back to normal.
|
||||||
// This function executes commands on a node so it will work only for some
|
// This function executes commands on a node so it will work only for some
|
||||||
// environments.
|
// environments.
|
||||||
@ -1017,13 +1047,13 @@ func TestUnderTemporaryNetworkFailure(c clientset.Interface, ns string, node *v1
|
|||||||
Failf("Error getting node external ip : %v", err)
|
Failf("Error getting node external ip : %v", err)
|
||||||
}
|
}
|
||||||
masterAddresses := GetAllMasterAddresses(c)
|
masterAddresses := GetAllMasterAddresses(c)
|
||||||
By(fmt.Sprintf("block network traffic from node %s to the master", node.Name))
|
ginkgo.By(fmt.Sprintf("block network traffic from node %s to the master", node.Name))
|
||||||
defer func() {
|
defer func() {
|
||||||
// This code will execute even if setting the iptables rule failed.
|
// This code will execute even if setting the iptables rule failed.
|
||||||
// It is on purpose because we may have an error even if the new rule
|
// It is on purpose because we may have an error even if the new rule
|
||||||
// had been inserted. (yes, we could look at the error code and ssh error
|
// had been inserted. (yes, we could look at the error code and ssh error
|
||||||
// separately, but I prefer to stay on the safe side).
|
// separately, but I prefer to stay on the safe side).
|
||||||
By(fmt.Sprintf("Unblock network traffic from node %s to the master", node.Name))
|
ginkgo.By(fmt.Sprintf("Unblock network traffic from node %s to the master", node.Name))
|
||||||
for _, masterAddress := range masterAddresses {
|
for _, masterAddress := range masterAddresses {
|
||||||
UnblockNetwork(host, masterAddress)
|
UnblockNetwork(host, masterAddress)
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,17 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
)
|
)
|
||||||
|
|
||||||
func EtcdUpgrade(target_storage, target_version string) error {
|
// EtcdUpgrade upgrades etcd on GCE.
|
||||||
|
func EtcdUpgrade(targetStorage, targetVersion string) error {
|
||||||
switch TestContext.Provider {
|
switch TestContext.Provider {
|
||||||
case "gce":
|
case "gce":
|
||||||
return etcdUpgradeGCE(target_storage, target_version)
|
return etcdUpgradeGCE(targetStorage, targetVersion)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("EtcdUpgrade() is not implemented for provider %s", TestContext.Provider)
|
return fmt.Errorf("EtcdUpgrade() is not implemented for provider %s", TestContext.Provider)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MasterUpgrade upgrades master node on GCE/GKE.
|
||||||
func MasterUpgrade(v string) error {
|
func MasterUpgrade(v string) error {
|
||||||
switch TestContext.Provider {
|
switch TestContext.Provider {
|
||||||
case "gce":
|
case "gce":
|
||||||
@ -52,17 +54,18 @@ func MasterUpgrade(v string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func etcdUpgradeGCE(target_storage, target_version string) error {
|
func etcdUpgradeGCE(targetStorage, targetVersion string) error {
|
||||||
env := append(
|
env := append(
|
||||||
os.Environ(),
|
os.Environ(),
|
||||||
"TEST_ETCD_VERSION="+target_version,
|
"TEST_ETCD_VERSION="+targetVersion,
|
||||||
"STORAGE_BACKEND="+target_storage,
|
"STORAGE_BACKEND="+targetStorage,
|
||||||
"TEST_ETCD_IMAGE=3.3.10-0")
|
"TEST_ETCD_IMAGE=3.3.10-0")
|
||||||
|
|
||||||
_, _, err := RunCmdEnv(env, gceUpgradeScript(), "-l", "-M")
|
_, _, err := RunCmdEnv(env, gceUpgradeScript(), "-l", "-M")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MasterUpgradeGCEWithKubeProxyDaemonSet upgrades master node on GCE with enabling/disabling the daemon set of kube-proxy.
|
||||||
// TODO(mrhohn): Remove this function when kube-proxy is run as a DaemonSet by default.
|
// TODO(mrhohn): Remove this function when kube-proxy is run as a DaemonSet by default.
|
||||||
func MasterUpgradeGCEWithKubeProxyDaemonSet(v string, enableKubeProxyDaemonSet bool) error {
|
func MasterUpgradeGCEWithKubeProxyDaemonSet(v string, enableKubeProxyDaemonSet bool) error {
|
||||||
return masterUpgradeGCE(v, enableKubeProxyDaemonSet)
|
return masterUpgradeGCE(v, enableKubeProxyDaemonSet)
|
||||||
@ -164,6 +167,7 @@ func masterUpgradeKubernetesAnywhere(v string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NodeUpgrade upgrades nodes on GCE/GKE.
|
||||||
func NodeUpgrade(f *Framework, v string, img string) error {
|
func NodeUpgrade(f *Framework, v string, img string) error {
|
||||||
// Perform the upgrade.
|
// Perform the upgrade.
|
||||||
var err error
|
var err error
|
||||||
@ -181,6 +185,7 @@ func NodeUpgrade(f *Framework, v string, img string) error {
|
|||||||
return waitForNodesReadyAfterUpgrade(f)
|
return waitForNodesReadyAfterUpgrade(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NodeUpgradeGCEWithKubeProxyDaemonSet upgrades nodes on GCE with enabling/disabling the daemon set of kube-proxy.
|
||||||
// TODO(mrhohn): Remove this function when kube-proxy is run as a DaemonSet by default.
|
// TODO(mrhohn): Remove this function when kube-proxy is run as a DaemonSet by default.
|
||||||
func NodeUpgradeGCEWithKubeProxyDaemonSet(f *Framework, v string, img string, enableKubeProxyDaemonSet bool) error {
|
func NodeUpgradeGCEWithKubeProxyDaemonSet(f *Framework, v string, img string, enableKubeProxyDaemonSet bool) error {
|
||||||
// Perform the upgrade.
|
// Perform the upgrade.
|
||||||
@ -365,6 +370,7 @@ func (k *NodeKiller) kill(nodes []v1.Node) {
|
|||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteNodeOnCloudProvider deletes the specified node.
|
||||||
func DeleteNodeOnCloudProvider(node *v1.Node) error {
|
func DeleteNodeOnCloudProvider(node *v1.Node) error {
|
||||||
return TestContext.CloudConfig.Provider.DeleteNode(node)
|
return TestContext.CloudConfig.Provider.DeleteNode(node)
|
||||||
}
|
}
|
||||||
|
@ -821,7 +821,7 @@ func newNetexecPodSpec(podName string, httpPort, udpPort int32, hostNetwork bool
|
|||||||
Containers: []v1.Container{
|
Containers: []v1.Container{
|
||||||
{
|
{
|
||||||
Name: "netexec",
|
Name: "netexec",
|
||||||
Image: NetexecImageName,
|
Image: netexecImageName,
|
||||||
Command: []string{
|
Command: []string{
|
||||||
"/netexec",
|
"/netexec",
|
||||||
fmt.Sprintf("--http-port=%d", httpPort),
|
fmt.Sprintf("--http-port=%d", httpPort),
|
||||||
|
@ -102,110 +102,110 @@ var _ = SIGDescribe("Networking", func() {
|
|||||||
|
|
||||||
It("should function for pod-Service: http", func() {
|
It("should function for pod-Service: http", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(http) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterHttpPort))
|
By(fmt.Sprintf("dialing(http) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterHTTPPort))
|
||||||
config.DialFromTestContainer("http", config.ClusterIP, framework.ClusterHttpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromTestContainer("http", config.ClusterIP, framework.ClusterHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
|
|
||||||
By(fmt.Sprintf("dialing(http) %v --> %v:%v (nodeIP)", config.TestContainerPod.Name, config.NodeIP, config.NodeHttpPort))
|
By(fmt.Sprintf("dialing(http) %v --> %v:%v (nodeIP)", config.TestContainerPod.Name, config.NodeIP, config.NodeHTTPPort))
|
||||||
config.DialFromTestContainer("http", config.NodeIP, config.NodeHttpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromTestContainer("http", config.NodeIP, config.NodeHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should function for pod-Service: udp", func() {
|
It("should function for pod-Service: udp", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterUdpPort))
|
By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterUDPPort))
|
||||||
config.DialFromTestContainer("udp", config.ClusterIP, framework.ClusterUdpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromTestContainer("udp", config.ClusterIP, framework.ClusterUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
|
|
||||||
By(fmt.Sprintf("dialing(udp) %v --> %v:%v (nodeIP)", config.TestContainerPod.Name, config.NodeIP, config.NodeUdpPort))
|
By(fmt.Sprintf("dialing(udp) %v --> %v:%v (nodeIP)", config.TestContainerPod.Name, config.NodeIP, config.NodeUDPPort))
|
||||||
config.DialFromTestContainer("udp", config.NodeIP, config.NodeUdpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromTestContainer("udp", config.NodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should function for node-Service: http", func() {
|
It("should function for node-Service: http", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(http) %v (node) --> %v:%v (config.clusterIP)", config.NodeIP, config.ClusterIP, framework.ClusterHttpPort))
|
By(fmt.Sprintf("dialing(http) %v (node) --> %v:%v (config.clusterIP)", config.NodeIP, config.ClusterIP, framework.ClusterHTTPPort))
|
||||||
config.DialFromNode("http", config.ClusterIP, framework.ClusterHttpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromNode("http", config.ClusterIP, framework.ClusterHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
|
|
||||||
By(fmt.Sprintf("dialing(http) %v (node) --> %v:%v (nodeIP)", config.NodeIP, config.NodeIP, config.NodeHttpPort))
|
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())
|
config.DialFromNode("http", config.NodeIP, config.NodeHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should function for node-Service: udp", func() {
|
It("should function for node-Service: udp", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(udp) %v (node) --> %v:%v (config.clusterIP)", config.NodeIP, config.ClusterIP, framework.ClusterUdpPort))
|
By(fmt.Sprintf("dialing(udp) %v (node) --> %v:%v (config.clusterIP)", config.NodeIP, config.ClusterIP, framework.ClusterUDPPort))
|
||||||
config.DialFromNode("udp", config.ClusterIP, framework.ClusterUdpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromNode("udp", config.ClusterIP, framework.ClusterUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
|
|
||||||
By(fmt.Sprintf("dialing(udp) %v (node) --> %v:%v (nodeIP)", config.NodeIP, config.NodeIP, config.NodeUdpPort))
|
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())
|
config.DialFromNode("udp", config.NodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should function for endpoint-Service: http", func() {
|
It("should function for endpoint-Service: http", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(http) %v (endpoint) --> %v:%v (config.clusterIP)", config.EndpointPods[0].Name, config.ClusterIP, framework.ClusterHttpPort))
|
By(fmt.Sprintf("dialing(http) %v (endpoint) --> %v:%v (config.clusterIP)", config.EndpointPods[0].Name, config.ClusterIP, framework.ClusterHTTPPort))
|
||||||
config.DialFromEndpointContainer("http", config.ClusterIP, framework.ClusterHttpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromEndpointContainer("http", config.ClusterIP, framework.ClusterHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
|
|
||||||
By(fmt.Sprintf("dialing(http) %v (endpoint) --> %v:%v (nodeIP)", config.EndpointPods[0].Name, config.NodeIP, config.NodeHttpPort))
|
By(fmt.Sprintf("dialing(http) %v (endpoint) --> %v:%v (nodeIP)", config.EndpointPods[0].Name, config.NodeIP, config.NodeHTTPPort))
|
||||||
config.DialFromEndpointContainer("http", config.NodeIP, config.NodeHttpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromEndpointContainer("http", config.NodeIP, config.NodeHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should function for endpoint-Service: udp", func() {
|
It("should function for endpoint-Service: udp", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(udp) %v (endpoint) --> %v:%v (config.clusterIP)", config.EndpointPods[0].Name, config.ClusterIP, framework.ClusterUdpPort))
|
By(fmt.Sprintf("dialing(udp) %v (endpoint) --> %v:%v (config.clusterIP)", config.EndpointPods[0].Name, config.ClusterIP, framework.ClusterUDPPort))
|
||||||
config.DialFromEndpointContainer("udp", config.ClusterIP, framework.ClusterUdpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromEndpointContainer("udp", config.ClusterIP, framework.ClusterUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
|
|
||||||
By(fmt.Sprintf("dialing(udp) %v (endpoint) --> %v:%v (nodeIP)", config.EndpointPods[0].Name, config.NodeIP, config.NodeUdpPort))
|
By(fmt.Sprintf("dialing(udp) %v (endpoint) --> %v:%v (nodeIP)", config.EndpointPods[0].Name, config.NodeIP, config.NodeUDPPort))
|
||||||
config.DialFromEndpointContainer("udp", config.NodeIP, config.NodeUdpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromEndpointContainer("udp", config.NodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should update endpoints: http", func() {
|
It("should update endpoints: http", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(http) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterHttpPort))
|
By(fmt.Sprintf("dialing(http) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterHTTPPort))
|
||||||
config.DialFromTestContainer("http", config.ClusterIP, framework.ClusterHttpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromTestContainer("http", config.ClusterIP, framework.ClusterHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
|
|
||||||
config.DeleteNetProxyPod()
|
config.DeleteNetProxyPod()
|
||||||
|
|
||||||
By(fmt.Sprintf("dialing(http) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterHttpPort))
|
By(fmt.Sprintf("dialing(http) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterHTTPPort))
|
||||||
config.DialFromTestContainer("http", config.ClusterIP, framework.ClusterHttpPort, config.MaxTries, config.MaxTries, config.EndpointHostnames())
|
config.DialFromTestContainer("http", config.ClusterIP, framework.ClusterHTTPPort, config.MaxTries, config.MaxTries, config.EndpointHostnames())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should update endpoints: udp", func() {
|
It("should update endpoints: udp", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterUdpPort))
|
By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterUDPPort))
|
||||||
config.DialFromTestContainer("udp", config.ClusterIP, framework.ClusterUdpPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromTestContainer("udp", config.ClusterIP, framework.ClusterUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
|
|
||||||
config.DeleteNetProxyPod()
|
config.DeleteNetProxyPod()
|
||||||
|
|
||||||
By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterUdpPort))
|
By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, framework.ClusterUDPPort))
|
||||||
config.DialFromTestContainer("udp", config.ClusterIP, framework.ClusterUdpPort, config.MaxTries, config.MaxTries, config.EndpointHostnames())
|
config.DialFromTestContainer("udp", config.ClusterIP, framework.ClusterUDPPort, config.MaxTries, config.MaxTries, config.EndpointHostnames())
|
||||||
})
|
})
|
||||||
|
|
||||||
// Slow because we confirm that the nodePort doesn't serve traffic, which requires a period of polling.
|
// Slow because we confirm that the nodePort doesn't serve traffic, which requires a period of polling.
|
||||||
It("should update nodePort: http [Slow]", func() {
|
It("should update nodePort: http [Slow]", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(http) %v (node) --> %v:%v (nodeIP)", config.NodeIP, config.NodeIP, config.NodeHttpPort))
|
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())
|
config.DialFromNode("http", config.NodeIP, config.NodeHTTPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
|
|
||||||
config.DeleteNodePortService()
|
config.DeleteNodePortService()
|
||||||
|
|
||||||
By(fmt.Sprintf("dialing(http) %v (node) --> %v:%v (nodeIP)", config.NodeIP, config.NodeIP, config.NodeHttpPort))
|
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, config.MaxTries, sets.NewString())
|
config.DialFromNode("http", config.NodeIP, config.NodeHTTPPort, config.MaxTries, config.MaxTries, sets.NewString())
|
||||||
})
|
})
|
||||||
|
|
||||||
// Slow because we confirm that the nodePort doesn't serve traffic, which requires a period of polling.
|
// Slow because we confirm that the nodePort doesn't serve traffic, which requires a period of polling.
|
||||||
It("should update nodePort: udp [Slow]", func() {
|
It("should update nodePort: udp [Slow]", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(udp) %v (node) --> %v:%v (nodeIP)", config.NodeIP, config.NodeIP, config.NodeUdpPort))
|
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())
|
config.DialFromNode("udp", config.NodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
|
|
||||||
config.DeleteNodePortService()
|
config.DeleteNodePortService()
|
||||||
|
|
||||||
By(fmt.Sprintf("dialing(udp) %v (node) --> %v:%v (nodeIP)", config.NodeIP, config.NodeIP, config.NodeUdpPort))
|
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, config.MaxTries, sets.NewString())
|
config.DialFromNode("udp", config.NodeIP, config.NodeUDPPort, config.MaxTries, config.MaxTries, sets.NewString())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should function for client IP based session affinity: http", func() {
|
It("should function for client IP based session affinity: http", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(http) %v --> %v:%v", config.TestContainerPod.Name, config.SessionAffinityService.Spec.ClusterIP, framework.ClusterHttpPort))
|
By(fmt.Sprintf("dialing(http) %v --> %v:%v", config.TestContainerPod.Name, config.SessionAffinityService.Spec.ClusterIP, framework.ClusterHTTPPort))
|
||||||
|
|
||||||
// Check if number of endpoints returned are exactly one.
|
// Check if number of endpoints returned are exactly one.
|
||||||
eps, err := config.GetEndpointsFromTestContainer("http", config.SessionAffinityService.Spec.ClusterIP, framework.ClusterHttpPort, framework.SessionAffinityChecks)
|
eps, err := config.GetEndpointsFromTestContainer("http", config.SessionAffinityService.Spec.ClusterIP, framework.ClusterHTTPPort, framework.SessionAffinityChecks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
framework.Failf("Failed to get endpoints from test container, error: %v", err)
|
framework.Failf("Failed to get endpoints from test container, error: %v", err)
|
||||||
}
|
}
|
||||||
@ -219,10 +219,10 @@ var _ = SIGDescribe("Networking", func() {
|
|||||||
|
|
||||||
It("should function for client IP based session affinity: udp", func() {
|
It("should function for client IP based session affinity: udp", func() {
|
||||||
config := framework.NewNetworkingTestConfig(f)
|
config := framework.NewNetworkingTestConfig(f)
|
||||||
By(fmt.Sprintf("dialing(udp) %v --> %v:%v", config.TestContainerPod.Name, config.SessionAffinityService.Spec.ClusterIP, framework.ClusterUdpPort))
|
By(fmt.Sprintf("dialing(udp) %v --> %v:%v", config.TestContainerPod.Name, config.SessionAffinityService.Spec.ClusterIP, framework.ClusterUDPPort))
|
||||||
|
|
||||||
// Check if number of endpoints returned are exactly one.
|
// Check if number of endpoints returned are exactly one.
|
||||||
eps, err := config.GetEndpointsFromTestContainer("udp", config.SessionAffinityService.Spec.ClusterIP, framework.ClusterUdpPort, framework.SessionAffinityChecks)
|
eps, err := config.GetEndpointsFromTestContainer("udp", config.SessionAffinityService.Spec.ClusterIP, framework.ClusterUDPPort, framework.SessionAffinityChecks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
framework.Failf("Failed to get endpoints from test container, error: %v", err)
|
framework.Failf("Failed to get endpoints from test container, error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ var _ = ginkgo.Describe("[sig-network] [sig-windows] Networking", func() {
|
|||||||
ginkgo.It("should function for intra-pod communication: http", func() {
|
ginkgo.It("should function for intra-pod communication: http", func() {
|
||||||
config := framework.NewCoreNetworkingTestConfig(f, false)
|
config := framework.NewCoreNetworkingTestConfig(f, false)
|
||||||
for _, endpointPod := range config.EndpointPods {
|
for _, endpointPod := range config.EndpointPods {
|
||||||
config.DialFromTestContainer("http", endpointPod.Status.PodIP, framework.EndpointHttpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
config.DialFromTestContainer("http", endpointPod.Status.PodIP, framework.EndpointHTTPPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ var _ = ginkgo.Describe("[sig-network] [sig-windows] Networking", func() {
|
|||||||
ginkgo.It("should function for intra-pod communication: udp", func() {
|
ginkgo.It("should function for intra-pod communication: udp", func() {
|
||||||
config := framework.NewCoreNetworkingTestConfig(f, false)
|
config := framework.NewCoreNetworkingTestConfig(f, false)
|
||||||
for _, endpointPod := range config.EndpointPods {
|
for _, endpointPod := range config.EndpointPods {
|
||||||
config.DialFromTestContainer("udp", endpointPod.Status.PodIP, framework.EndpointUdpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
config.DialFromTestContainer("udp", endpointPod.Status.PodIP, framework.EndpointUDPPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ var _ = ginkgo.Describe("[sig-network] [sig-windows] Networking", func() {
|
|||||||
ginkgo.It("should function for node-pod communication: http", func() {
|
ginkgo.It("should function for node-pod communication: http", func() {
|
||||||
config := framework.NewCoreNetworkingTestConfig(f, false)
|
config := framework.NewCoreNetworkingTestConfig(f, false)
|
||||||
for _, endpointPod := range config.EndpointPods {
|
for _, endpointPod := range config.EndpointPods {
|
||||||
config.DialFromNode("http", endpointPod.Status.PodIP, framework.EndpointHttpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
config.DialFromNode("http", endpointPod.Status.PodIP, framework.EndpointHTTPPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ var _ = ginkgo.Describe("[sig-network] [sig-windows] Networking", func() {
|
|||||||
ginkgo.It("should function for node-pod communication: udp", func() {
|
ginkgo.It("should function for node-pod communication: udp", func() {
|
||||||
config := framework.NewCoreNetworkingTestConfig(f, false)
|
config := framework.NewCoreNetworkingTestConfig(f, false)
|
||||||
for _, endpointPod := range config.EndpointPods {
|
for _, endpointPod := range config.EndpointPods {
|
||||||
config.DialFromNode("udp", endpointPod.Status.PodIP, framework.EndpointUdpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
config.DialFromNode("udp", endpointPod.Status.PodIP, framework.EndpointUDPPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user