Merge pull request #124876 from danwinship/kind-loadbalancers-1
e2e-kind-cloud-provider-loadbalancer fixes, part 1
This commit is contained in:
		@@ -387,8 +387,8 @@ var _ = common.SIGDescribe("LoadBalancers", feature.LoadBalancer, func() {
 | 
				
			|||||||
		err = udpJig.Scale(ctx, 0)
 | 
							err = udpJig.Scale(ctx, 0)
 | 
				
			||||||
		framework.ExpectNoError(err)
 | 
							framework.ExpectNoError(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ginkgo.By("looking for ICMP REJECT on the UDP service's LoadBalancer")
 | 
							ginkgo.By("checking that the UDP service's LoadBalancer is not reachable")
 | 
				
			||||||
		testRejectedUDP(ctx, udpIngressIP, svcPort, loadBalancerCreateTimeout)
 | 
							testNotReachableUDP(ctx, udpIngressIP, svcPort, loadBalancerCreateTimeout)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ginkgo.By("Scaling the pods to 1")
 | 
							ginkgo.By("Scaling the pods to 1")
 | 
				
			||||||
		err = udpJig.Scale(ctx, 1)
 | 
							err = udpJig.Scale(ctx, 1)
 | 
				
			||||||
@@ -927,11 +927,6 @@ var _ = common.SIGDescribe("LoadBalancers", feature.LoadBalancer, func() {
 | 
				
			|||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var _ = common.SIGDescribe("LoadBalancers ExternalTrafficPolicy: Local", feature.LoadBalancer, framework.WithSlow(), func() {
 | 
					var _ = common.SIGDescribe("LoadBalancers ExternalTrafficPolicy: Local", feature.LoadBalancer, framework.WithSlow(), func() {
 | 
				
			||||||
	// FIXME: What are the expected semantics of requesting an
 | 
					 | 
				
			||||||
	// "ExternalTrafficPolicy: Local" service from a cloud provider that does not
 | 
					 | 
				
			||||||
	// support that? What are the expected semantics of "ExternalTrafficPolicy: Local"
 | 
					 | 
				
			||||||
	// on `IPMode: Proxy`-type LoadBalancers?
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	f := framework.NewDefaultFramework("esipp")
 | 
						f := framework.NewDefaultFramework("esipp")
 | 
				
			||||||
	f.NamespacePodSecurityLevel = admissionapi.LevelBaseline
 | 
						f.NamespacePodSecurityLevel = admissionapi.LevelBaseline
 | 
				
			||||||
	var loadBalancerCreateTimeout time.Duration
 | 
						var loadBalancerCreateTimeout time.Duration
 | 
				
			||||||
@@ -987,6 +982,14 @@ var _ = common.SIGDescribe("LoadBalancers ExternalTrafficPolicy: Local", feature
 | 
				
			|||||||
			framework.ExpectNoError(err)
 | 
								framework.ExpectNoError(err)
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// FIXME: figure out the actual expected semantics for
 | 
				
			||||||
 | 
							// "ExternalTrafficPolicy: Local" + "IPMode: Proxy".
 | 
				
			||||||
 | 
							// https://issues.k8s.io/123714
 | 
				
			||||||
 | 
							ingress := &svc.Status.LoadBalancer.Ingress[0]
 | 
				
			||||||
 | 
							if ingress.IP == "" || (ingress.IPMode != nil && *ingress.IPMode == v1.LoadBalancerIPModeProxy) {
 | 
				
			||||||
 | 
								e2eskipper.Skipf("LoadBalancer uses 'Proxy' IPMode")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		svcTCPPort := int(svc.Spec.Ports[0].Port)
 | 
							svcTCPPort := int(svc.Spec.Ports[0].Port)
 | 
				
			||||||
		ingressIP := e2eservice.GetIngressPoint(&svc.Status.LoadBalancer.Ingress[0])
 | 
							ingressIP := e2eservice.GetIngressPoint(&svc.Status.LoadBalancer.Ingress[0])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1133,6 +1136,14 @@ var _ = common.SIGDescribe("LoadBalancers ExternalTrafficPolicy: Local", feature
 | 
				
			|||||||
			framework.ExpectNoError(err)
 | 
								framework.ExpectNoError(err)
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// FIXME: figure out the actual expected semantics for
 | 
				
			||||||
 | 
							// "ExternalTrafficPolicy: Local" + "IPMode: Proxy".
 | 
				
			||||||
 | 
							// https://issues.k8s.io/123714
 | 
				
			||||||
 | 
							ingress := &svc.Status.LoadBalancer.Ingress[0]
 | 
				
			||||||
 | 
							if ingress.IP == "" || (ingress.IPMode != nil && *ingress.IPMode == v1.LoadBalancerIPModeProxy) {
 | 
				
			||||||
 | 
								e2eskipper.Skipf("LoadBalancer uses 'Proxy' IPMode")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ingressIP := e2eservice.GetIngressPoint(&svc.Status.LoadBalancer.Ingress[0])
 | 
							ingressIP := e2eservice.GetIngressPoint(&svc.Status.LoadBalancer.Ingress[0])
 | 
				
			||||||
		port := strconv.Itoa(int(svc.Spec.Ports[0].Port))
 | 
							port := strconv.Itoa(int(svc.Spec.Ports[0].Port))
 | 
				
			||||||
		ipPort := net.JoinHostPort(ingressIP, port)
 | 
							ipPort := net.JoinHostPort(ingressIP, port)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -606,20 +606,6 @@ func testNotReachableUDP(ctx context.Context, host string, port int, timeout tim
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// testRejectedUDP tests that the given host rejects a UDP request on the given port.
 | 
					 | 
				
			||||||
func testRejectedUDP(ctx context.Context, host string, port int, timeout time.Duration) {
 | 
					 | 
				
			||||||
	pollfn := func(ctx context.Context) (bool, error) {
 | 
					 | 
				
			||||||
		result := pokeUDP(host, port, "echo hello", &UDPPokeParams{Timeout: 3 * time.Second})
 | 
					 | 
				
			||||||
		if result.Status == UDPRefused {
 | 
					 | 
				
			||||||
			return true, nil
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return false, nil // caller can retry
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if err := wait.PollUntilContextTimeout(ctx, framework.Poll, timeout, true, pollfn); err != nil {
 | 
					 | 
				
			||||||
		framework.Failf("UDP service %v:%v not rejected: %v", host, port, err)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// TestHTTPHealthCheckNodePort tests a HTTP connection by the given request to the given host and port.
 | 
					// TestHTTPHealthCheckNodePort tests a HTTP connection by the given request to the given host and port.
 | 
				
			||||||
func TestHTTPHealthCheckNodePort(ctx context.Context, host string, port int, request string, timeout time.Duration, expectSucceed bool, threshold int) error {
 | 
					func TestHTTPHealthCheckNodePort(ctx context.Context, host string, port int, request string, timeout time.Duration, expectSucceed bool, threshold int) error {
 | 
				
			||||||
	count := 0
 | 
						count := 0
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user