Skip to content

Commit b421bde

Browse files
committed
Drop GCE-only tests and subtests from LoadBalancer tests
1 parent 35a8c0f commit b421bde

File tree

3 files changed

+0
-291
lines changed

3 files changed

+0
-291
lines changed

test/e2e/feature/feature.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ var (
147147
// Ingress.networking.k8s.io to be present.
148148
Ingress = framework.WithFeature(framework.ValidFeatures.Add("Ingress"))
149149

150-
// TODO: document the feature (owning SIG, when to use this feature for a test)
151-
IngressScale = framework.WithFeature(framework.ValidFeatures.Add("IngressScale"))
152-
153150
// TODO: document the feature (owning SIG, when to use this feature for a test)
154151
InPlacePodVerticalScaling = framework.WithFeature(framework.ValidFeatures.Add("InPlacePodVerticalScaling"))
155152

@@ -190,9 +187,6 @@ var (
190187
// TODO: document the feature (owning SIG, when to use this feature for a test)
191188
MemoryManager = framework.WithFeature(framework.ValidFeatures.Add("MemoryManager"))
192189

193-
// TODO: document the feature (owning SIG, when to use this feature for a test)
194-
NEG = framework.WithFeature(framework.ValidFeatures.Add("NEG"))
195-
196190
// Owner: sig-network
197191
// Marks tests that require working external DNS.
198192
NetworkingDNS = framework.WithFeature(framework.ValidFeatures.Add("Networking-DNS"))

test/e2e/network/loadbalancer.go

Lines changed: 0 additions & 279 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"context"
2424
"fmt"
2525
"io"
26-
"math/big"
2726
"net"
2827
"net/http"
2928
"strconv"
@@ -32,8 +31,6 @@ import (
3231
"sync/atomic"
3332
"time"
3433

35-
compute "google.golang.org/api/compute/v1"
36-
3734
appsv1 "k8s.io/api/apps/v1"
3835
v1 "k8s.io/api/core/v1"
3936
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -52,7 +49,6 @@ import (
5249
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
5350
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
5451
e2eoutput "k8s.io/kubernetes/test/e2e/framework/pod/output"
55-
"k8s.io/kubernetes/test/e2e/framework/providers/gce"
5652
e2erc "k8s.io/kubernetes/test/e2e/framework/rc"
5753
e2eservice "k8s.io/kubernetes/test/e2e/framework/service"
5854
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
@@ -125,13 +121,9 @@ var _ = common.SIGDescribe("LoadBalancers", func() {
125121
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
126122

127123
var cs clientset.Interface
128-
var subnetPrefix *net.IPNet
129-
var err error
130124

131125
ginkgo.BeforeEach(func(ctx context.Context) {
132126
cs = f.ClientSet
133-
subnetPrefix, err = getSubnetPrefix(ctx, cs)
134-
framework.ExpectNoError(err)
135127
})
136128

137129
ginkgo.AfterEach(func(ctx context.Context) {
@@ -187,37 +179,8 @@ var _ = common.SIGDescribe("LoadBalancers", func() {
187179
framework.ExpectNoError(err)
188180

189181
// Change the services to LoadBalancer.
190-
191-
// Here we test that LoadBalancers can receive static IP addresses. This isn't
192-
// necessary, but is an additional feature this monolithic test checks.
193-
requestedIP := ""
194-
staticIPName := ""
195-
if framework.ProviderIs("gce", "gke") {
196-
ginkgo.By("creating a static load balancer IP")
197-
staticIPName = fmt.Sprintf("e2e-external-lb-test-%s", framework.RunID)
198-
gceCloud, err := gce.GetGCECloud()
199-
framework.ExpectNoError(err, "failed to get GCE cloud provider")
200-
201-
err = gceCloud.ReserveRegionAddress(&compute.Address{Name: staticIPName}, gceCloud.Region())
202-
defer func() {
203-
if staticIPName != "" {
204-
// Release GCE static IP - this is not kube-managed and will not be automatically released.
205-
if err := gceCloud.DeleteRegionAddress(staticIPName, gceCloud.Region()); err != nil {
206-
framework.Logf("failed to release static IP %s: %v", staticIPName, err)
207-
}
208-
}
209-
}()
210-
framework.ExpectNoError(err, "failed to create region address: %s", staticIPName)
211-
reservedAddr, err := gceCloud.GetRegionAddress(staticIPName, gceCloud.Region())
212-
framework.ExpectNoError(err, "failed to get region address: %s", staticIPName)
213-
214-
requestedIP = reservedAddr.Address
215-
framework.Logf("Allocated static load balancer IP: %s", requestedIP)
216-
}
217-
218182
ginkgo.By("changing the TCP service to type=LoadBalancer")
219183
_, err = tcpJig.UpdateService(ctx, func(s *v1.Service) {
220-
s.Spec.LoadBalancerIP = requestedIP // will be "" if not applicable
221184
s.Spec.Type = v1.ServiceTypeLoadBalancer
222185
})
223186
framework.ExpectNoError(err)
@@ -229,30 +192,9 @@ var _ = common.SIGDescribe("LoadBalancers", func() {
229192
if int(tcpService.Spec.Ports[0].NodePort) != tcpNodePort {
230193
framework.Failf("TCP Spec.Ports[0].NodePort changed (%d -> %d) when not expected", tcpNodePort, tcpService.Spec.Ports[0].NodePort)
231194
}
232-
if requestedIP != "" && e2eservice.GetIngressPoint(&tcpService.Status.LoadBalancer.Ingress[0]) != requestedIP {
233-
framework.Failf("unexpected TCP Status.LoadBalancer.Ingress (expected %s, got %s)", requestedIP, e2eservice.GetIngressPoint(&tcpService.Status.LoadBalancer.Ingress[0]))
234-
}
235195
tcpIngressIP := e2eservice.GetIngressPoint(&tcpService.Status.LoadBalancer.Ingress[0])
236196
framework.Logf("TCP load balancer: %s", tcpIngressIP)
237197

238-
if framework.ProviderIs("gce", "gke") {
239-
// Do this as early as possible, which overrides the `defer` above.
240-
// This is mostly out of fear of leaking the IP in a timeout case
241-
// (as of this writing we're not 100% sure where the leaks are
242-
// coming from, so this is first-aid rather than surgery).
243-
ginkgo.By("demoting the static IP to ephemeral")
244-
if staticIPName != "" {
245-
gceCloud, err := gce.GetGCECloud()
246-
framework.ExpectNoError(err, "failed to get GCE cloud provider")
247-
// Deleting it after it is attached "demotes" it to an
248-
// ephemeral IP, which can be auto-released.
249-
if err := gceCloud.DeleteRegionAddress(staticIPName, gceCloud.Region()); err != nil {
250-
framework.Failf("failed to release static IP %s: %v", staticIPName, err)
251-
}
252-
staticIPName = ""
253-
}
254-
}
255-
256198
err = tcpJig.CheckServiceReachability(ctx, tcpService, execPod)
257199
framework.ExpectNoError(err)
258200

@@ -377,54 +319,12 @@ var _ = common.SIGDescribe("LoadBalancers", func() {
377319
framework.ExpectNoError(err)
378320

379321
// Change the services to LoadBalancer.
380-
381-
// Here we test that LoadBalancers can receive static IP addresses. This isn't
382-
// necessary, but is an additional feature this monolithic test checks.
383-
requestedIP := ""
384-
staticIPName := ""
385-
ginkgo.By("creating a static load balancer IP")
386-
staticIPName = fmt.Sprintf("e2e-external-lb-test-%s", framework.RunID)
387-
gceCloud, err := gce.GetGCECloud()
388-
framework.ExpectNoError(err, "failed to get GCE cloud provider")
389-
390-
err = gceCloud.ReserveRegionAddress(&compute.Address{Name: staticIPName}, gceCloud.Region())
391-
defer func() {
392-
if staticIPName != "" {
393-
// Release GCE static IP - this is not kube-managed and will not be automatically released.
394-
if err := gceCloud.DeleteRegionAddress(staticIPName, gceCloud.Region()); err != nil {
395-
framework.Logf("failed to release static IP %s: %v", staticIPName, err)
396-
}
397-
}
398-
}()
399-
framework.ExpectNoError(err, "failed to create region address: %s", staticIPName)
400-
reservedAddr, err := gceCloud.GetRegionAddress(staticIPName, gceCloud.Region())
401-
framework.ExpectNoError(err, "failed to get region address: %s", staticIPName)
402-
403-
requestedIP = reservedAddr.Address
404-
framework.Logf("Allocated static load balancer IP: %s", requestedIP)
405-
406322
ginkgo.By("changing the UDP service to type=LoadBalancer")
407323
_, err = udpJig.UpdateService(ctx, func(s *v1.Service) {
408324
s.Spec.Type = v1.ServiceTypeLoadBalancer
409325
})
410326
framework.ExpectNoError(err)
411327

412-
// Do this as early as possible, which overrides the `defer` above.
413-
// This is mostly out of fear of leaking the IP in a timeout case
414-
// (as of this writing we're not 100% sure where the leaks are
415-
// coming from, so this is first-aid rather than surgery).
416-
ginkgo.By("demoting the static IP to ephemeral")
417-
if staticIPName != "" {
418-
gceCloud, err := gce.GetGCECloud()
419-
framework.ExpectNoError(err, "failed to get GCE cloud provider")
420-
// Deleting it after it is attached "demotes" it to an
421-
// ephemeral IP, which can be auto-released.
422-
if err := gceCloud.DeleteRegionAddress(staticIPName, gceCloud.Region()); err != nil {
423-
framework.Failf("failed to release static IP %s: %v", staticIPName, err)
424-
}
425-
staticIPName = ""
426-
}
427-
428328
var udpIngressIP string
429329
ginkgo.By("waiting for the UDP service to have a load balancer")
430330
// 2nd one should be faster since they ran in parallel.
@@ -611,135 +511,6 @@ var _ = common.SIGDescribe("LoadBalancers", func() {
611511
checkReachabilityFromPod(true, loadBalancerCreateTimeout, namespace, dropPod.Name, svcIP)
612512
})
613513

614-
f.It("should be able to create an internal type load balancer", f.WithSlow(), func(ctx context.Context) {
615-
e2eskipper.SkipUnlessProviderIs("gke", "gce")
616-
617-
createTimeout := e2eservice.GetServiceLoadBalancerCreationTimeout(ctx, cs)
618-
pollInterval := framework.Poll * 10
619-
620-
namespace := f.Namespace.Name
621-
serviceName := "lb-internal"
622-
jig := e2eservice.NewTestJig(cs, namespace, serviceName)
623-
624-
ginkgo.By("creating pod to be part of service " + serviceName)
625-
_, err := jig.Run(ctx, nil)
626-
framework.ExpectNoError(err)
627-
628-
enableILB, disableILB := enableAndDisableInternalLB()
629-
630-
isInternalEndpoint := func(lbIngress *v1.LoadBalancerIngress) bool {
631-
ingressEndpoint := e2eservice.GetIngressPoint(lbIngress)
632-
ingressIP := netutils.ParseIPSloppy(ingressEndpoint)
633-
if ingressIP == nil {
634-
framework.Failf("invalid ingressEndpoint IP address format: %s", ingressEndpoint)
635-
}
636-
// Needs update for providers using hostname as endpoint.
637-
return subnetPrefix.Contains(ingressIP)
638-
}
639-
640-
ginkgo.By("creating a service with type LoadBalancer and cloud specific Internal-LB annotation enabled")
641-
svc, err := jig.CreateTCPService(ctx, func(svc *v1.Service) {
642-
svc.Spec.Type = v1.ServiceTypeLoadBalancer
643-
enableILB(svc)
644-
})
645-
framework.ExpectNoError(err)
646-
647-
ginkgo.DeferCleanup(func(ctx context.Context) {
648-
ginkgo.By("Clean up loadbalancer service")
649-
e2eservice.WaitForServiceDeletedWithFinalizer(ctx, cs, svc.Namespace, svc.Name)
650-
})
651-
652-
svc, err = jig.WaitForLoadBalancer(ctx, createTimeout)
653-
framework.ExpectNoError(err)
654-
lbIngress := &svc.Status.LoadBalancer.Ingress[0]
655-
svcPort := int(svc.Spec.Ports[0].Port)
656-
// should have an internal IP.
657-
if !isInternalEndpoint(lbIngress) {
658-
framework.Failf("lbIngress %v doesn't have an internal IP", lbIngress)
659-
}
660-
661-
// ILBs are not accessible from the test orchestrator, so it's necessary to use
662-
// a pod to test the service.
663-
ginkgo.By("hitting the internal load balancer from pod")
664-
framework.Logf("creating pod with host network")
665-
hostExec := launchHostExecPod(ctx, f.ClientSet, f.Namespace.Name, "ilb-host-exec")
666-
667-
framework.Logf("Waiting up to %v for service %q's internal LB to respond to requests", createTimeout, serviceName)
668-
tcpIngressIP := e2eservice.GetIngressPoint(lbIngress)
669-
if pollErr := wait.PollImmediate(pollInterval, createTimeout, func() (bool, error) {
670-
cmd := fmt.Sprintf(`curl -m 5 'http://%v:%v/echo?msg=hello'`, tcpIngressIP, svcPort)
671-
stdout, err := e2eoutput.RunHostCmd(hostExec.Namespace, hostExec.Name, cmd)
672-
if err != nil {
673-
framework.Logf("error curling; stdout: %v. err: %v", stdout, err)
674-
return false, nil
675-
}
676-
677-
if !strings.Contains(stdout, "hello") {
678-
framework.Logf("Expected output to contain 'hello', got %q; retrying...", stdout)
679-
return false, nil
680-
}
681-
682-
framework.Logf("Successful curl; stdout: %v", stdout)
683-
return true, nil
684-
}); pollErr != nil {
685-
framework.Failf("ginkgo.Failed to hit ILB IP, err: %v", pollErr)
686-
}
687-
688-
ginkgo.By("switching to external type LoadBalancer")
689-
svc, err = jig.UpdateService(ctx, func(svc *v1.Service) {
690-
disableILB(svc)
691-
})
692-
framework.ExpectNoError(err)
693-
framework.Logf("Waiting up to %v for service %q to have an external LoadBalancer", createTimeout, serviceName)
694-
if pollErr := wait.PollImmediate(pollInterval, createTimeout, func() (bool, error) {
695-
svc, err := cs.CoreV1().Services(namespace).Get(ctx, serviceName, metav1.GetOptions{})
696-
if err != nil {
697-
return false, err
698-
}
699-
lbIngress = &svc.Status.LoadBalancer.Ingress[0]
700-
return !isInternalEndpoint(lbIngress), nil
701-
}); pollErr != nil {
702-
framework.Failf("Loadbalancer IP not changed to external.")
703-
}
704-
// should have an external IP.
705-
gomega.Expect(isInternalEndpoint(lbIngress)).To(gomega.BeFalse())
706-
707-
ginkgo.By("hitting the external load balancer")
708-
framework.Logf("Waiting up to %v for service %q's external LB to respond to requests", createTimeout, serviceName)
709-
tcpIngressIP = e2eservice.GetIngressPoint(lbIngress)
710-
e2eservice.TestReachableHTTP(ctx, tcpIngressIP, svcPort, e2eservice.LoadBalancerLagTimeoutDefault)
711-
712-
// GCE cannot test a specific IP because the test may not own it. This cloud specific condition
713-
// will be removed when GCP supports similar functionality.
714-
if framework.ProviderIs("azure") {
715-
ginkgo.By("switching back to interal type LoadBalancer, with static IP specified.")
716-
// For a cluster created with CAPZ, node-subnet may not be "10.240.0.0/16", e.g. "10.1.0.0/16".
717-
base := netutils.BigForIP(subnetPrefix.IP)
718-
offset := big.NewInt(0).SetBytes(netutils.ParseIPSloppy("0.0.11.11").To4()).Int64()
719-
720-
internalStaticIP := netutils.AddIPOffset(base, int(offset)).String()
721-
722-
svc, err = jig.UpdateService(ctx, func(svc *v1.Service) {
723-
svc.Spec.LoadBalancerIP = internalStaticIP
724-
enableILB(svc)
725-
})
726-
framework.ExpectNoError(err)
727-
framework.Logf("Waiting up to %v for service %q to have an internal LoadBalancer", createTimeout, serviceName)
728-
if pollErr := wait.PollImmediate(pollInterval, createTimeout, func() (bool, error) {
729-
svc, err := cs.CoreV1().Services(namespace).Get(ctx, serviceName, metav1.GetOptions{})
730-
if err != nil {
731-
return false, err
732-
}
733-
lbIngress = &svc.Status.LoadBalancer.Ingress[0]
734-
return isInternalEndpoint(lbIngress), nil
735-
}); pollErr != nil {
736-
framework.Failf("Loadbalancer IP not changed to internal.")
737-
}
738-
// should have the given static internal IP.
739-
gomega.Expect(e2eservice.GetIngressPoint(lbIngress)).To(gomega.Equal(internalStaticIP))
740-
}
741-
})
742-
743514
// [LinuxOnly]: Windows does not support session affinity.
744515
f.It("should have session affinity work for LoadBalancer service with ESIPP on", f.WithSlow(), "[LinuxOnly]", func(ctx context.Context) {
745516
// L4 load balancer affinity `ClientIP` is not supported on AWS ELB.
@@ -852,37 +623,8 @@ var _ = common.SIGDescribe("LoadBalancers", func() {
852623
framework.ExpectNoError(err)
853624

854625
// Change the services to LoadBalancer.
855-
856-
// Here we test that LoadBalancers can receive static IP addresses. This isn't
857-
// necessary, but is an additional feature this monolithic test checks.
858-
requestedIP := ""
859-
staticIPName := ""
860-
if framework.ProviderIs("gce", "gke") {
861-
ginkgo.By("creating a static load balancer IP")
862-
staticIPName = fmt.Sprintf("e2e-external-lb-test-%s", framework.RunID)
863-
gceCloud, err := gce.GetGCECloud()
864-
framework.ExpectNoError(err, "failed to get GCE cloud provider")
865-
866-
err = gceCloud.ReserveRegionAddress(&compute.Address{Name: staticIPName}, gceCloud.Region())
867-
ginkgo.DeferCleanup(func(ctx context.Context) {
868-
if staticIPName != "" {
869-
// Release GCE static IP - this is not kube-managed and will not be automatically released.
870-
if err := gceCloud.DeleteRegionAddress(staticIPName, gceCloud.Region()); err != nil {
871-
framework.Logf("failed to release static IP %s: %v", staticIPName, err)
872-
}
873-
}
874-
})
875-
framework.ExpectNoError(err, "failed to create region address: %s", staticIPName)
876-
reservedAddr, err := gceCloud.GetRegionAddress(staticIPName, gceCloud.Region())
877-
framework.ExpectNoError(err, "failed to get region address: %s", staticIPName)
878-
879-
requestedIP = reservedAddr.Address
880-
framework.Logf("Allocated static load balancer IP: %s", requestedIP)
881-
}
882-
883626
ginkgo.By("changing the TCP service to type=LoadBalancer")
884627
_, err = tcpJig.UpdateService(ctx, func(s *v1.Service) {
885-
s.Spec.LoadBalancerIP = requestedIP // will be "" if not applicable
886628
s.Spec.Type = v1.ServiceTypeLoadBalancer
887629
s.Spec.AllocateLoadBalancerNodePorts = utilpointer.BoolPtr(false)
888630
})
@@ -895,30 +637,9 @@ var _ = common.SIGDescribe("LoadBalancers", func() {
895637
if int(tcpService.Spec.Ports[0].NodePort) != 0 {
896638
framework.Failf("TCP Spec.Ports[0].NodePort allocated %d when not expected", tcpService.Spec.Ports[0].NodePort)
897639
}
898-
if requestedIP != "" && e2eservice.GetIngressPoint(&tcpService.Status.LoadBalancer.Ingress[0]) != requestedIP {
899-
framework.Failf("unexpected TCP Status.LoadBalancer.Ingress (expected %s, got %s)", requestedIP, e2eservice.GetIngressPoint(&tcpService.Status.LoadBalancer.Ingress[0]))
900-
}
901640
tcpIngressIP := e2eservice.GetIngressPoint(&tcpService.Status.LoadBalancer.Ingress[0])
902641
framework.Logf("TCP load balancer: %s", tcpIngressIP)
903642

904-
if framework.ProviderIs("gce", "gke") {
905-
// Do this as early as possible, which overrides the `defer` above.
906-
// This is mostly out of fear of leaking the IP in a timeout case
907-
// (as of this writing we're not 100% sure where the leaks are
908-
// coming from, so this is first-aid rather than surgery).
909-
ginkgo.By("demoting the static IP to ephemeral")
910-
if staticIPName != "" {
911-
gceCloud, err := gce.GetGCECloud()
912-
framework.ExpectNoError(err, "failed to get GCE cloud provider")
913-
// Deleting it after it is attached "demotes" it to an
914-
// ephemeral IP, which can be auto-released.
915-
if err := gceCloud.DeleteRegionAddress(staticIPName, gceCloud.Region()); err != nil {
916-
framework.Failf("failed to release static IP %s: %v", staticIPName, err)
917-
}
918-
staticIPName = ""
919-
}
920-
}
921-
922643
ginkgo.By("hitting the TCP service's LoadBalancer")
923644
e2eservice.TestReachableHTTP(ctx, tcpIngressIP, svcPort, loadBalancerLagTimeout)
924645

0 commit comments

Comments
 (0)