Merge pull request #34360 from bprashanth/np_fix

Automatic merge from submit-queue

Remove onlyLocal NodePort e2e till pr #33957

We were basically testing this bug: https://github.com/kubernetes/kubernetes/issues/30809
We fixed the bug: https://github.com/kubernetes/kubernetes/pull/33587, but forgot to remove the "test". 
This pr adds a test for the new feature: https://github.com/kubernetes/kubernetes/pull/33957 (ensure that nodePort with onlyLocal works only on nodes with endpoints and fails otherwise)

fixes https://github.com/kubernetes/kubernetes/issues/34124
This commit is contained in:
Kubernetes Submit Queue 2016-10-10 14:49:01 -07:00 committed by GitHub
commit 9e2f868be0

View File

@ -1101,8 +1101,6 @@ var _ = framework.KubeDescribe("Services", func() {
jig.SanityCheckService(svc, api.ServiceTypeLoadBalancer)
svcTcpPort := int(svc.Spec.Ports[0].Port)
framework.Logf("service port : %d", svcTcpPort)
tcpNodePort := int(svc.Spec.Ports[0].NodePort)
framework.Logf("TCP node port: %d", tcpNodePort)
ingressIP := getIngressPoint(&svc.Status.LoadBalancer.Ingress[0])
framework.Logf("TCP load balancer: %s", ingressIP)
healthCheckNodePort := int(service.GetServiceHealthCheckNodePort(svc))
@ -1110,18 +1108,12 @@ var _ = framework.KubeDescribe("Services", func() {
if healthCheckNodePort == 0 {
framework.Failf("Service HealthCheck NodePort was not allocated")
}
nodeIP := pickNodeIP(jig.Client)
By("hitting the TCP service's NodePort on " + nodeIP + ":" + fmt.Sprintf("%d", tcpNodePort))
jig.TestReachableHTTP(nodeIP, tcpNodePort, kubeProxyLagTimeout)
// TODO(33957): test localOnly nodePort Services.
By("hitting the TCP service's service port, via its external VIP " + ingressIP + ":" + fmt.Sprintf("%d", svcTcpPort))
jig.TestReachableHTTP(ingressIP, svcTcpPort, kubeProxyLagTimeout)
By("reading clientIP using the TCP service's NodePort")
content := jig.GetHTTPContent(nodeIP, tcpNodePort, kubeProxyLagTimeout, "/clientip")
clientIP := content.String()
framework.Logf("ClientIP detected by target pod using NodePort is %s", clientIP)
By("reading clientIP using the TCP service's service port via its external VIP")
content = jig.GetHTTPContent(ingressIP, svcTcpPort, kubeProxyLagTimeout, "/clientip")
clientIP = content.String()
content := jig.GetHTTPContent(ingressIP, svcTcpPort, kubeProxyLagTimeout, "/clientip")
clientIP := content.String()
framework.Logf("ClientIP detected by target pod using VIP:SvcPort is %s", clientIP)
By("checking if Source IP is preserved")
if strings.HasPrefix(clientIP, "10.") {