@@ -12,21 +12,21 @@ import (
1212 networkingv1 "k8s.io/api/networking/v1"
1313 agav1beta1 "sigs.k8s.io/aws-load-balancer-controller/apis/aga/v1beta1"
1414 "sigs.k8s.io/aws-load-balancer-controller/test/e2e/ingress"
15- "sigs.k8s.io/aws-load-balancer-controller/test/e2e/service"
1615 "sigs.k8s.io/aws-load-balancer-controller/test/framework/utils"
1716)
1817
1918var _ = Describe ("GlobalAccelerator with multiple endpoint types" , func () {
2019 var (
21- ctx context.Context
22- agaStack * ResourceStack
23- svcStack * service.ResourceStack
24- ingStack * ingress.ResourceStack
25- namespace string
26- svcName string
27- ingName string
28- aga * agav1beta1.GlobalAccelerator
29- baseName string
20+ ctx context.Context
21+ agaStack * ResourceStack
22+ ingStack * ingress.ResourceStack
23+ namespace string
24+ svcName string
25+ ingName string
26+ aga * agav1beta1.GlobalAccelerator
27+ baseName string
28+ svcDeployment * appsv1.Deployment
29+ nlbSvc * corev1.Service
3030 )
3131
3232 BeforeEach (func () {
@@ -52,12 +52,13 @@ var _ = Describe("GlobalAccelerator with multiple endpoint types", func() {
5252 Expect (err ).NotTo (HaveOccurred ())
5353
5454 // Deploy Service endpoint resources in the same namespace
55- svcDeployment : = createDeployment (baseName + "-svc" , namespace , labels )
55+ svcDeployment = createDeployment (baseName + "-svc" , namespace , labels )
5656 nlbAnnotations := createServiceAnnotations ("nlb-ip" , "internet-facing" , tf .Options .IPFamily )
57- nlbSvc : = createLoadBalancerService (svcName , labels , nlbAnnotations )
57+ nlbSvc = createLoadBalancerService (svcName , labels , nlbAnnotations )
5858 nlbSvc .Namespace = namespace
59- svcStack = service .NewResourceStack (svcDeployment , nlbSvc , nil , namespace , true )
60- err = svcStack .Deploy (ctx , tf )
59+ err = tf .K8sClient .Create (ctx , svcDeployment )
60+ Expect (err ).NotTo (HaveOccurred ())
61+ err = tf .K8sClient .Create (ctx , nlbSvc )
6162 Expect (err ).NotTo (HaveOccurred ())
6263 })
6364
@@ -66,17 +67,25 @@ var _ = Describe("GlobalAccelerator with multiple endpoint types", func() {
6667 err := agaStack .Cleanup (ctx , tf )
6768 Expect (err ).NotTo (HaveOccurred ())
6869 }
70+ if nlbSvc != nil {
71+ err := tf .K8sClient .Delete (ctx , nlbSvc )
72+ if err != nil {
73+ tf .Logger .Info ("failed to delete service" , "error" , err )
74+ }
75+ }
76+ if svcDeployment != nil {
77+ err := tf .K8sClient .Delete (ctx , svcDeployment )
78+ if err != nil {
79+ tf .Logger .Info ("failed to delete deployment" , "error" , err )
80+ }
81+ }
6982 if ingStack != nil {
7083 err := ingStack .Cleanup (ctx , tf )
7184 Expect (err ).NotTo (HaveOccurred ())
7285 }
73- if svcStack != nil {
74- err := svcStack .Cleanup (ctx , tf )
75- Expect (err ).NotTo (HaveOccurred ())
76- }
7786 })
7887
79- Context ("Multiple endpoint types with port overrides " , func () {
88+ Context ("Multiple endpoint" , func () {
8089 It ("Should create GlobalAccelerator with Service and Ingress endpoints" , func () {
8190 acceleratorName := "aga-multi-" + utils .RandomDNS1123Label (6 )
8291 protocol := agav1beta1 .GlobalAcceleratorProtocolTCP
@@ -87,14 +96,15 @@ var _ = Describe("GlobalAccelerator with multiple endpoint types", func() {
8796 "svcName" , svcName ,
8897 "ingName" , ingName )
8998
99+ svcEndpoint := createServiceEndpoint (svcName , 128 )
90100 aga = createAGA (gaName , namespace , acceleratorName , agav1beta1 .IPAddressTypeIPV4 , & []agav1beta1.GlobalAcceleratorListener {{
91101 Protocol : & protocol ,
92102 PortRanges : & []agav1beta1.PortRange {{FromPort : 80 , ToPort : 80 }},
93103 ClientAffinity : agav1beta1 .ClientAffinityNone ,
94104 EndpointGroups : & []agav1beta1.GlobalAcceleratorEndpointGroup {{
95105 TrafficDialPercentage : awssdk .Int32 (100 ),
96106 Endpoints : & []agav1beta1.GlobalAcceleratorEndpoint {
97- { Type : agav1beta1 . GlobalAcceleratorEndpointTypeService , Name : awssdk . String ( svcName )} ,
107+ svcEndpoint ,
98108 {Type : agav1beta1 .GlobalAcceleratorEndpointTypeIngress , Name : awssdk .String (ingName )},
99109 },
100110 }},
@@ -118,7 +128,7 @@ var _ = Describe("GlobalAccelerator with multiple endpoint types", func() {
118128 ClientAffinity : string (types .ClientAffinityNone ),
119129 EndpointGroups : []EndpointGroupExpectation {{
120130 TrafficDialPercentage : 100 ,
121- NumEndpoints : 1 ,
131+ NumEndpoints : 2 ,
122132 }},
123133 }},
124134 })
0 commit comments