Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions test/e2e/gateway/alb_instance_target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var _ = Describe("test k8s alb gateway using instance targets reconciled by the
},
}
auxiliaryStack = newAuxiliaryResourceStack(ctx, tf, tgSpec, true)
httpr := buildHTTPRoute([]string{}, []gwv1.HTTPRouteRule{}, &gwListeners[0].Name)
httpr := BuildHTTPRoute([]string{}, []gwv1.HTTPRouteRule{}, &gwListeners[0].Name)
By("deploying stack", func() {
err := stack.DeployHTTP(ctx, auxiliaryStack, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -228,7 +228,7 @@ var _ = Describe("test k8s alb gateway using instance targets reconciled by the
Protocol: gwv1.HTTPProtocolType,
},
}
httpr := buildHTTPRoute([]string{}, httpRouteRuleWithMatchesAndTargetGroupWeights, nil)
httpr := BuildHTTPRoute([]string{}, httpRouteRuleWithMatchesAndTargetGroupWeights, nil)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expand Down Expand Up @@ -438,7 +438,7 @@ var _ = Describe("test k8s alb gateway using instance targets reconciled by the
Protocol: gwv1.HTTPProtocolType,
},
}
httpr := buildHTTPRoute([]string{}, httpRouteRuleWithMatchesAndFilters, nil)
httpr := BuildHTTPRoute([]string{}, httpRouteRuleWithMatchesAndFilters, nil)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expand Down Expand Up @@ -518,7 +518,7 @@ var _ = Describe("test k8s alb gateway using instance targets reconciled by the
},
}

httpr := buildHTTPRoute([]string{}, httpRouteRuleWithMultiMatchesInSingleRule, nil)
httpr := BuildHTTPRoute([]string{}, httpRouteRuleWithMultiMatchesInSingleRule, nil)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expand Down Expand Up @@ -716,7 +716,7 @@ var _ = Describe("test k8s alb gateway using instance targets reconciled by the
Hostname: (*gwv1.Hostname)(awssdk.String(testHostname)),
},
}
httpr := buildHTTPRoute([]string{testHostname}, []gwv1.HTTPRouteRule{}, nil)
httpr := BuildHTTPRoute([]string{testHostname}, []gwv1.HTTPRouteRule{}, nil)
By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -821,7 +821,7 @@ var _ = Describe("test k8s alb gateway using instance targets reconciled by the
Hostname: (*gwv1.Hostname)(awssdk.String(testHostname)),
},
}
httpr := buildHTTPRoute([]string{testHostname}, []gwv1.HTTPRouteRule{}, nil)
httpr := BuildHTTPRoute([]string{testHostname}, []gwv1.HTTPRouteRule{}, nil)
By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -966,7 +966,7 @@ var _ = Describe("test k8s alb gateway using instance targets reconciled by the
},
},
}
httpr := buildHTTPRoute([]string{testHostname}, httpRouteRules, &gwListeners[0].Name)
httpr := BuildHTTPRoute([]string{testHostname}, httpRouteRules, &gwListeners[0].Name)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, false)
Expand Down Expand Up @@ -1173,7 +1173,7 @@ var _ = Describe("test k8s alb gateway using instance targets reconciled by the
},
},
}
httpr := buildHTTPRoute([]string{testHostname}, httpRouteRules, &gwListeners[0].Name)
httpr := BuildHTTPRoute([]string{testHostname}, httpRouteRules, &gwListeners[0].Name)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, oidcSecret, false)
Expand Down Expand Up @@ -1344,7 +1344,7 @@ var _ = Describe("test k8s alb gateway using instance targets reconciled by the
Hostname: (*gwv1.Hostname)(awssdk.String(testHostname)),
},
}
httpr := buildHTTPRoute([]string{testHostname}, []gwv1.HTTPRouteRule{}, nil)
httpr := BuildHTTPRoute([]string{testHostname}, []gwv1.HTTPRouteRule{}, nil)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expand Down
20 changes: 10 additions & 10 deletions test/e2e/gateway/alb_ip_target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var _ = Describe("test k8s alb gateway using ip targets reconciled by the aws lo
},
}
auxiliaryStack = newAuxiliaryResourceStack(ctx, tf, tgSpec, true)
httpr := buildHTTPRoute([]string{}, []gwv1.HTTPRouteRule{}, &gwListeners[0].Name)
httpr := BuildHTTPRoute([]string{}, []gwv1.HTTPRouteRule{}, &gwListeners[0].Name)
By("deploying stack", func() {
err := stack.DeployHTTP(ctx, auxiliaryStack, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -217,7 +217,7 @@ var _ = Describe("test k8s alb gateway using ip targets reconciled by the aws lo
},
}

httpr := buildHTTPRoute([]string{}, httpRouteRuleWithMatchesAndTargetGroupWeights, nil)
httpr := BuildHTTPRoute([]string{}, httpRouteRuleWithMatchesAndTargetGroupWeights, nil)
By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -424,7 +424,7 @@ var _ = Describe("test k8s alb gateway using ip targets reconciled by the aws lo
Protocol: gwv1.HTTPProtocolType,
},
}
httpr := buildHTTPRoute([]string{}, httpRouteRuleWithMatchesAndFilters, nil)
httpr := BuildHTTPRoute([]string{}, httpRouteRuleWithMatchesAndFilters, nil)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expand Down Expand Up @@ -503,7 +503,7 @@ var _ = Describe("test k8s alb gateway using ip targets reconciled by the aws lo
},
}

httpr := buildHTTPRoute([]string{}, httpRouteRuleWithMultiMatchesInSingleRule, nil)
httpr := BuildHTTPRoute([]string{}, httpRouteRuleWithMultiMatchesInSingleRule, nil)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expand Down Expand Up @@ -687,7 +687,7 @@ var _ = Describe("test k8s alb gateway using ip targets reconciled by the aws lo
}

lrcSpec := elbv2gw.ListenerRuleConfigurationSpec{}
httpr := buildHTTPRoute([]string{}, []gwv1.HTTPRouteRule{}, &gwListeners[0].Name)
httpr := BuildHTTPRoute([]string{}, []gwv1.HTTPRouteRule{}, &gwListeners[0].Name)
httpr.Spec.Rules[0].Filters = []gwv1.HTTPRouteFilter{
{
Type: gwv1.HTTPRouteFilterURLRewrite,
Expand Down Expand Up @@ -835,7 +835,7 @@ var _ = Describe("test k8s alb gateway using ip targets reconciled by the aws lo
},
}

httpr := buildHTTPRoute([]string{testHostname}, []gwv1.HTTPRouteRule{}, nil)
httpr := BuildHTTPRoute([]string{testHostname}, []gwv1.HTTPRouteRule{}, nil)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expand Down Expand Up @@ -947,7 +947,7 @@ var _ = Describe("test k8s alb gateway using ip targets reconciled by the aws lo
},
}

httpr := buildHTTPRoute([]string{testHostname}, []gwv1.HTTPRouteRule{}, nil)
httpr := BuildHTTPRoute([]string{testHostname}, []gwv1.HTTPRouteRule{}, nil)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expand Down Expand Up @@ -1099,7 +1099,7 @@ var _ = Describe("test k8s alb gateway using ip targets reconciled by the aws lo
},
},
}
httpr := buildHTTPRoute([]string{testHostname}, httpRouteRules, nil)
httpr := BuildHTTPRoute([]string{testHostname}, httpRouteRules, nil)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, false)
Expand Down Expand Up @@ -1309,7 +1309,7 @@ var _ = Describe("test k8s alb gateway using ip targets reconciled by the aws lo
},
},
}
httpr := buildHTTPRoute([]string{testHostname}, httpRouteRules, nil)
httpr := BuildHTTPRoute([]string{testHostname}, httpRouteRules, nil)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, oidcSecret, false)
Expand Down Expand Up @@ -1478,7 +1478,7 @@ var _ = Describe("test k8s alb gateway using ip targets reconciled by the aws lo
},
}

httpr := buildHTTPRoute([]string{}, []gwv1.HTTPRouteRule{}, nil)
httpr := BuildHTTPRoute([]string{}, []gwv1.HTTPRouteRule{}, nil)

By("deploying stack", func() {
err := stack.DeployHTTP(ctx, nil, tf, gwListeners, []*gwv1.HTTPRoute{httpr}, lbcSpec, tgSpec, lrcSpec, nil, true)
Expand Down
7 changes: 4 additions & 3 deletions test/e2e/gateway/alb_nlb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ package gateway
import (
"context"
"fmt"
"strings"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
elbv2gw "sigs.k8s.io/aws-load-balancer-controller/apis/gateway/v1beta1"
"sigs.k8s.io/aws-load-balancer-controller/test/framework/http"
"sigs.k8s.io/aws-load-balancer-controller/test/framework/verifier"
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
gwbeta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
"strings"
"time"
)

var _ = Describe("test combined ALB and NLB gateways with HTTPRoute and TCPRoute", func() {
Expand Down Expand Up @@ -94,7 +95,7 @@ var _ = Describe("test combined ALB and NLB gateways with HTTPRoute and TCPRoute
}

// HTTPRoute for ALB
httpr := buildHTTPRoute([]string{}, []gwv1.HTTPRouteRule{}, nil)
httpr := BuildHTTPRoute([]string{}, []gwv1.HTTPRouteRule{}, nil)

By("deploying ALB stack", func() {
err := albStack.DeployHTTP(ctx, nil, tf, albGwListeners, []*gwv1.HTTPRoute{httpr}, albLbcSpec, tgSpec, lrcSpec, nil, true)
Expand Down
13 changes: 10 additions & 3 deletions test/e2e/gateway/alb_resource_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gateway
import (
"context"
"fmt"

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
rbac "k8s.io/api/rbac/v1"
Expand Down Expand Up @@ -64,9 +65,11 @@ func (s *albResourceStack) Deploy(ctx context.Context, f *framework.Framework) e
})
}

func (s *albResourceStack) Cleanup(ctx context.Context, f *framework.Framework) {
s.commonStack.Cleanup(ctx, f)
s.deleteOIDCSecretWithRBAC(ctx, f)
func (s *albResourceStack) Cleanup(ctx context.Context, f *framework.Framework) error {
if err := s.commonStack.Cleanup(ctx, f); err != nil {
return err
}
return s.deleteOIDCSecretWithRBAC(ctx, f)
}

func (s *albResourceStack) GetLoadBalancerIngressHostname() string {
Expand All @@ -77,6 +80,10 @@ func (s *albResourceStack) getListenersPortMap() map[string]string {
return s.commonStack.getListenersPortMap()
}

func (s *albResourceStack) GetNamespace() string {
return s.commonStack.ns.Name
}

func (s *albResourceStack) waitUntilDeploymentReady(ctx context.Context, f *framework.Framework) error {
return waitUntilDeploymentReady(ctx, f, s.commonStack.dps)
}
Expand Down
8 changes: 6 additions & 2 deletions test/e2e/gateway/alb_test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,18 @@ func (s *ALBTestStack) deploy(ctx context.Context, f *framework.Framework, gwLis
return s.albResourceStack.Deploy(ctx, f)
}

func (s *ALBTestStack) Cleanup(ctx context.Context, f *framework.Framework) {
s.albResourceStack.Cleanup(ctx, f)
func (s *ALBTestStack) Cleanup(ctx context.Context, f *framework.Framework) error {
return s.albResourceStack.Cleanup(ctx, f)
}

func (s *ALBTestStack) GetLoadBalancerIngressHostName() string {
return s.albResourceStack.GetLoadBalancerIngressHostname()
}

func (s *ALBTestStack) GetNamespace() string {
return s.albResourceStack.GetNamespace()
}

func (s *ALBTestStack) GetWorkerNodes(ctx context.Context, f *framework.Framework) ([]corev1.Node, error) {
allNodes := &corev1.NodeList{}
err := f.K8sClient.List(ctx, allNodes)
Expand Down
20 changes: 13 additions & 7 deletions test/e2e/gateway/common_resource_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ func (s *commonResourceStack) Deploy(ctx context.Context, f *framework.Framework
v.Namespace = s.ns.Name
}

for _, v := range s.tgcs {
v.Namespace = s.ns.Name
if s.tgcs != nil {
for _, v := range s.tgcs {
v.Namespace = s.ns.Name
}
}

for _, v := range s.lrcs {
v.Namespace = s.ns.Name
if s.lrcs != nil {
for _, v := range s.lrcs {
v.Namespace = s.ns.Name
}
}

s.gw.Namespace = s.ns.Name
Expand Down Expand Up @@ -120,9 +124,11 @@ func (s *commonResourceStack) Deploy(ctx context.Context, f *framework.Framework
return nil
}

func (s *commonResourceStack) Cleanup(ctx context.Context, f *framework.Framework) {
_ = deleteNamespace(ctx, f, s.ns)
_ = deleteGatewayClass(ctx, f, s.gwc)
func (s *commonResourceStack) Cleanup(ctx context.Context, f *framework.Framework) error {
if err := deleteNamespace(ctx, f, s.ns); err != nil {
return err
}
return deleteGatewayClass(ctx, f, s.gwc)
}

func (s *commonResourceStack) GetLoadBalancerIngressHostname() string {
Expand Down
9 changes: 7 additions & 2 deletions test/e2e/gateway/nlb_resource_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gateway

import (
"context"

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
elbv2gw "sigs.k8s.io/aws-load-balancer-controller/apis/gateway/v1beta1"
Expand Down Expand Up @@ -58,8 +59,8 @@ func (s *nlbResourceStack) Deploy(ctx context.Context, f *framework.Framework) e
})
}

func (s *nlbResourceStack) Cleanup(ctx context.Context, f *framework.Framework) {
s.commonStack.Cleanup(ctx, f)
func (s *nlbResourceStack) Cleanup(ctx context.Context, f *framework.Framework) error {
return s.commonStack.Cleanup(ctx, f)
}

func (s *nlbResourceStack) GetLoadBalancerIngressHostname() string {
Expand All @@ -74,6 +75,10 @@ func (s *nlbResourceStack) waitUntilDeploymentReady(ctx context.Context, f *fram
return waitUntilDeploymentReady(ctx, f, s.commonStack.dps)
}

func (s *nlbResourceStack) GetNamespace() string {
return s.commonStack.ns.Name
}

func (s *nlbResourceStack) createTCPRoutes(ctx context.Context, f *framework.Framework) error {
for _, tcpr := range s.tcprs {
f.Logger.Info("creating tcp route", "tcpr", k8s.NamespacedName(tcpr))
Expand Down
8 changes: 6 additions & 2 deletions test/e2e/gateway/nlb_test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,18 @@ func (s *NLBTestStack) CreateFENLBReferenceGrant(ctx context.Context, f *framewo
return refGrant, nil
}

func (s *NLBTestStack) Cleanup(ctx context.Context, f *framework.Framework) {
s.nlbResourceStack.Cleanup(ctx, f)
func (s *NLBTestStack) Cleanup(ctx context.Context, f *framework.Framework) error {
return s.nlbResourceStack.Cleanup(ctx, f)
}

func (s *NLBTestStack) GetLoadBalancerIngressHostName() string {
return s.nlbResourceStack.GetLoadBalancerIngressHostname()
}

func (s *NLBTestStack) GetNamespace() string {
return s.nlbResourceStack.GetNamespace()
}

func (s *NLBTestStack) GetWorkerNodes(ctx context.Context, f *framework.Framework) ([]corev1.Node, error) {
allNodes := &corev1.NodeList{}
err := f.K8sClient.List(ctx, allNodes)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gateway/shared_resource_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ func buildUDPRoute(sectionName string) *gwalpha2.UDPRoute {
return udpr
}

func buildHTTPRoute(hostnames []string, rules []gwv1.HTTPRouteRule, sectionName *gwv1.SectionName) *gwv1.HTTPRoute {
func BuildHTTPRoute(hostnames []string, rules []gwv1.HTTPRouteRule, sectionName *gwv1.SectionName) *gwv1.HTTPRoute {
routeName := fmt.Sprintf("%v-%v", defaultName, utils.RandomDNS1123Label(6))
httpr := &gwv1.HTTPRoute{
ObjectMeta: metav1.ObjectMeta{
Expand Down
Loading
Loading