Skip to content

Commit 65b2f92

Browse files
authored
Merge pull request #4413 from zac-nixon/znixon/gw-no-sg-tgb-refactor
[gw api] Support SG rule generation for no SG LBs
2 parents 5947078 + ba53fb6 commit 65b2f92

14 files changed

+2404
-501
lines changed

pkg/aga/tag_helper_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,13 @@ func Test_tagHelperImpl_validateTagCollisionWithExternalManagedTags(t *testing.T
235235
// Error message will contain one of the colliding tags
236236
},
237237
{
238-
name: "no collision - empty tags",
239-
tags: map[string]string{},
238+
name: "no collision - empty tags",
239+
tags: map[string]string{},
240240
externalManagedTags: []string{"ExternalTag", "ManagedByTeam"},
241241
wantErr: false,
242242
},
243243
{
244-
name: "no collision - nil tags",
244+
name: "no collision - nil tags",
245245
tags: nil,
246246
externalManagedTags: []string{"ExternalTag", "ManagedByTeam"},
247247
wantErr: false,
@@ -252,7 +252,7 @@ func Test_tagHelperImpl_validateTagCollisionWithExternalManagedTags(t *testing.T
252252
"externaltag": "external-value", // lowercase
253253
},
254254
externalManagedTags: []string{"ExternalTag"}, // uppercase
255-
wantErr: false, // Should not collide due to case sensitivity
255+
wantErr: false, // Should not collide due to case sensitivity
256256
},
257257
}
258258

@@ -324,11 +324,11 @@ func Test_newTagHelper(t *testing.T) {
324324
helper := newTagHelper(externalManagedTagsSet, tt.defaultTags)
325325

326326
assert.NotNil(t, helper)
327-
327+
328328
// Verify the helper is of the correct type
329329
helperImpl, ok := helper.(*tagHelperImpl)
330330
assert.True(t, ok)
331-
331+
332332
// Verify the fields are set correctly
333333
assert.Equal(t, externalManagedTagsSet, helperImpl.externalManagedTags)
334334
assert.Equal(t, tt.defaultTags, helperImpl.defaultTags)

pkg/deploy/tracking/provider_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ func Test_defaultProvider_StackTags(t *testing.T) {
109109
func Test_defaultProvider_ResourceTags(t *testing.T) {
110110
ingressStack := core.NewDefaultStack(core.StackID{Namespace: "namespace", Name: "ingressName"})
111111
ingressFakeRes := core.NewFakeResource(ingressStack, "fake", "fake-id", core.FakeResourceSpec{}, nil)
112-
112+
113113
serviceStack := core.NewDefaultStack(core.StackID{Namespace: "namespace", Name: "serviceName"})
114114
serviceFakeRes := core.NewFakeResource(serviceStack, "fake", "service-id", core.FakeResourceSpec{}, nil)
115-
115+
116116
agaStack := core.NewDefaultStack(core.StackID{Namespace: "namespace", Name: "globalAcceleratorName"})
117117
agaFakeRes := core.NewFakeResource(agaStack, "fake", "accelerator-id", core.FakeResourceSpec{}, nil)
118-
118+
119119
gatewayStack := core.NewDefaultStack(core.StackID{Namespace: "namespace", Name: "gatewayName"})
120120
gatewayFakeRes := core.NewFakeResource(gatewayStack, "fake", "gateway-id", core.FakeResourceSpec{}, nil)
121121

pkg/gateway/model/base_model_builder.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ type baseModelBuilder struct {
126126

127127
func (baseBuilder *baseModelBuilder) Build(ctx context.Context, gw *gwv1.Gateway, lbConf elbv2gw.LoadBalancerConfiguration, routes map[int32][]routeutils.RouteDescriptor, currentAddonConfig []addon.Addon, secretsManager k8s.SecretsManager, targetGroupNameToArnMapper shared_utils.TargetGroupARNMapper) (core.Stack, *elbv2model.LoadBalancer, []addon.AddonMetadata, bool, []types.NamespacedName, error) {
128128
stack := core.NewDefaultStack(core.StackID(k8s.NamespacedName(gw)))
129-
tgBuilder := newTargetGroupBuilder(baseBuilder.clusterName, baseBuilder.vpcID, baseBuilder.gwTagHelper, baseBuilder.loadBalancerType, baseBuilder.tgPropertiesConstructor, baseBuilder.disableRestrictedSGRules, baseBuilder.defaultTargetType, targetGroupNameToArnMapper)
130-
listenerBuilder := newListenerBuilder(baseBuilder.loadBalancerType, tgBuilder, baseBuilder.gwTagHelper, baseBuilder.clusterName, baseBuilder.defaultSSLPolicy, baseBuilder.elbv2Client, baseBuilder.acmClient, baseBuilder.k8sClient, baseBuilder.allowedCAARNs, secretsManager, baseBuilder.logger)
131129
var isPreDelete bool
132130
if gw.DeletionTimestamp != nil && !gw.DeletionTimestamp.IsZero() {
133131
if baseBuilder.isDeleteProtected(lbConf) {
@@ -189,7 +187,11 @@ func (baseBuilder *baseModelBuilder) Build(ctx context.Context, gw *gwv1.Gateway
189187

190188
lb := elbv2model.NewLoadBalancer(stack, shared_constants.ResourceIDLoadBalancer, spec)
191189

192-
secrets, err := listenerBuilder.buildListeners(ctx, stack, lb, securityGroups, gw, routes, lbConf)
190+
tgbNetworkingBuilder := newTargetGroupBindingNetworkBuilder(baseBuilder.disableRestrictedSGRules, baseBuilder.vpcID, spec.Scheme, lbConf.Spec.SourceRanges, securityGroups, subnets.ec2Result, baseBuilder.vpcInfoProvider)
191+
tgBuilder := newTargetGroupBuilder(baseBuilder.clusterName, baseBuilder.vpcID, baseBuilder.gwTagHelper, baseBuilder.loadBalancerType, tgbNetworkingBuilder, baseBuilder.tgPropertiesConstructor, baseBuilder.defaultTargetType, targetGroupNameToArnMapper)
192+
listenerBuilder := newListenerBuilder(baseBuilder.loadBalancerType, tgBuilder, baseBuilder.gwTagHelper, baseBuilder.clusterName, baseBuilder.defaultSSLPolicy, baseBuilder.elbv2Client, baseBuilder.acmClient, baseBuilder.k8sClient, baseBuilder.allowedCAARNs, secretsManager, baseBuilder.logger)
193+
194+
secrets, err := listenerBuilder.buildListeners(ctx, stack, lb, gw, routes, lbConf)
193195
if err != nil {
194196
return nil, nil, nil, false, nil, err
195197
}
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
package model
22

33
import (
4-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4+
"k8s.io/apimachinery/pkg/util/intstr"
55
elbv2gw "sigs.k8s.io/aws-load-balancer-controller/apis/gateway/v1beta1"
66
"sigs.k8s.io/aws-load-balancer-controller/pkg/gateway/routeutils"
77
"sigs.k8s.io/aws-load-balancer-controller/pkg/model/core"
88
elbv2model "sigs.k8s.io/aws-load-balancer-controller/pkg/model/elbv2"
9-
"sigs.k8s.io/aws-load-balancer-controller/pkg/model/elbv2/k8s"
9+
elbv2modelk8s "sigs.k8s.io/aws-load-balancer-controller/pkg/model/elbv2/k8s"
1010
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
1111
)
1212

13-
type MockTargetGroupBuilder struct {
13+
type mockTargetGroupBuilder struct {
1414
tgs []*elbv2model.TargetGroup
1515
buildErr error
1616
}
1717

18-
func (m *MockTargetGroupBuilder) buildTargetGroup(stack core.Stack, gw *gwv1.Gateway, lbConfig elbv2gw.LoadBalancerConfiguration, lbIPType elbv2model.IPAddressType, routeDescriptor routeutils.RouteDescriptor, backend routeutils.Backend, backendSGIDToken core.StringToken) (core.StringToken, error) {
18+
func (m *mockTargetGroupBuilder) buildTargetGroup(stack core.Stack,
19+
gw *gwv1.Gateway, lbConfig elbv2gw.LoadBalancerConfiguration, lbIPType elbv2model.IPAddressType, routeDescriptor routeutils.RouteDescriptor, backend routeutils.Backend) (core.StringToken, error) {
1920
var tg *elbv2model.TargetGroup
2021

2122
if len(m.tgs) > 0 {
@@ -30,14 +31,15 @@ func (m *MockTargetGroupBuilder) buildTargetGroup(stack core.Stack, gw *gwv1.Gat
3031
return arn, m.buildErr
3132
}
3233

33-
func (m *MockTargetGroupBuilder) buildTargetGroupSpec(gw *gwv1.Gateway, route routeutils.RouteDescriptor, lbConfig elbv2gw.LoadBalancerConfiguration, lbIPType elbv2model.IPAddressType, backend routeutils.Backend, targetGroupProps *elbv2gw.TargetGroupProps) (elbv2model.TargetGroupSpec, error) {
34-
//TODO implement me
35-
panic("implement me")
34+
var _ targetGroupBuilder = &mockTargetGroupBuilder{}
35+
36+
type mockTargetGroupBindingNetworkingBuilder struct {
37+
result *elbv2modelk8s.TargetGroupBindingNetworking
38+
err error
3639
}
3740

38-
func (m *MockTargetGroupBuilder) buildTargetGroupBindingSpec(gw *gwv1.Gateway, tgProps *elbv2gw.TargetGroupProps, tgSpec elbv2model.TargetGroupSpec, nodeSelector *metav1.LabelSelector, backend routeutils.Backend, backendSGIDToken core.StringToken) k8s.TargetGroupBindingResourceSpec {
39-
//TODO implement me
40-
panic("implement me")
41+
func (m *mockTargetGroupBindingNetworkingBuilder) buildTargetGroupBindingNetworking(targetGroupSpec elbv2model.TargetGroupSpec, targetPort intstr.IntOrString) (*elbv2modelk8s.TargetGroupBindingNetworking, error) {
42+
return m.result, m.err
4143
}
4244

43-
var _ targetGroupBuilder = &MockTargetGroupBuilder{}
45+
var _ targetGroupBindingNetworkBuilder = &mockTargetGroupBindingNetworkingBuilder{}

pkg/gateway/model/model_build_listener.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ type gwListenerConfig struct {
3131
}
3232

3333
type listenerBuilder interface {
34-
buildListeners(ctx context.Context, stack core.Stack, lb *elbv2model.LoadBalancer, securityGroups securityGroupOutput, gw *gwv1.Gateway, routes map[int32][]routeutils.RouteDescriptor, lbConf elbv2gw.LoadBalancerConfiguration) ([]types.NamespacedName, error)
35-
buildListenerSpec(ctx context.Context, lb *elbv2model.LoadBalancer, gw *gwv1.Gateway, port int32, lbCfg elbv2gw.LoadBalancerConfiguration, gwLsCfg *gwListenerConfig, lbLsCfg *elbv2gw.ListenerConfiguration) (*elbv2model.ListenerSpec, error)
36-
buildL7ListenerSpec(ctx context.Context, lb *elbv2model.LoadBalancer, gw *gwv1.Gateway, lbCfg elbv2gw.LoadBalancerConfiguration, port int32, gwLsCfg *gwListenerConfig, lbLsCfg *elbv2gw.ListenerConfiguration) (*elbv2model.ListenerSpec, error)
37-
buildL4ListenerSpec(ctx context.Context, stack core.Stack, lb *elbv2model.LoadBalancer, securityGroups securityGroupOutput, gw *gwv1.Gateway, lbCfg elbv2gw.LoadBalancerConfiguration, port int32, routes []routeutils.RouteDescriptor, gwLsCfg *gwListenerConfig, lbLsCfg *elbv2gw.ListenerConfiguration) (*elbv2model.ListenerSpec, error)
34+
buildListeners(ctx context.Context, stack core.Stack, lb *elbv2model.LoadBalancer, gw *gwv1.Gateway, routes map[int32][]routeutils.RouteDescriptor, lbConf elbv2gw.LoadBalancerConfiguration) ([]types.NamespacedName, error)
3835
}
3936

4037
type listenerBuilderImpl struct {
@@ -51,7 +48,7 @@ type listenerBuilderImpl struct {
5148
logger logr.Logger
5249
}
5350

54-
func (l listenerBuilderImpl) buildListeners(ctx context.Context, stack core.Stack, lb *elbv2model.LoadBalancer, securityGroups securityGroupOutput, gw *gwv1.Gateway, routes map[int32][]routeutils.RouteDescriptor, lbCfg elbv2gw.LoadBalancerConfiguration) ([]types.NamespacedName, error) {
51+
func (l listenerBuilderImpl) buildListeners(ctx context.Context, stack core.Stack, lb *elbv2model.LoadBalancer, gw *gwv1.Gateway, routes map[int32][]routeutils.RouteDescriptor, lbCfg elbv2gw.LoadBalancerConfiguration) ([]types.NamespacedName, error) {
5552
gwLsCfgs, err := mapGatewayListenerConfigsByPort(gw, routes)
5653
if err != nil {
5754
return nil, err
@@ -63,7 +60,7 @@ func (l listenerBuilderImpl) buildListeners(ctx context.Context, stack core.Stac
6360
if len(gwLsPorts.Intersection(portsWithRoutes).List()) != 0 {
6461
lbLsCfgs := mapLoadBalancerListenerConfigsByPort(lbCfg)
6562
for _, port := range gwLsPorts.Intersection(portsWithRoutes).List() {
66-
ls, err := l.buildListener(ctx, stack, lb, securityGroups, gw, port, routes[port], lbCfg, gwLsCfgs[port], lbLsCfgs[port])
63+
ls, err := l.buildListener(ctx, stack, lb, gw, port, routes[port], lbCfg, gwLsCfgs[port], lbLsCfgs[port])
6764
if err != nil {
6865
return nil, err
6966
}
@@ -74,7 +71,7 @@ func (l listenerBuilderImpl) buildListeners(ctx context.Context, stack core.Stac
7471

7572
// build rules only for L7 gateways
7673
if l.loadBalancerType == elbv2model.LoadBalancerTypeApplication {
77-
secretKeys, err := l.buildListenerRules(ctx, stack, ls, lb.Spec.IPAddressType, securityGroups, gw, port, lbCfg, routes)
74+
secretKeys, err := l.buildListenerRules(ctx, stack, ls, lb.Spec.IPAddressType, gw, port, lbCfg, routes)
7875
if err != nil {
7976
return nil, err
8077
}
@@ -86,14 +83,14 @@ func (l listenerBuilderImpl) buildListeners(ctx context.Context, stack core.Stac
8683
return secrets, nil
8784
}
8885

89-
func (l listenerBuilderImpl) buildListener(ctx context.Context, stack core.Stack, lb *elbv2model.LoadBalancer, securityGroups securityGroupOutput, gw *gwv1.Gateway, port int32, routes []routeutils.RouteDescriptor, lbCfg elbv2gw.LoadBalancerConfiguration, gwLsCfg *gwListenerConfig, lbLsCfg *elbv2gw.ListenerConfiguration) (*elbv2model.Listener, error) {
86+
func (l listenerBuilderImpl) buildListener(ctx context.Context, stack core.Stack, lb *elbv2model.LoadBalancer, gw *gwv1.Gateway, port int32, routes []routeutils.RouteDescriptor, lbCfg elbv2gw.LoadBalancerConfiguration, gwLsCfg *gwListenerConfig, lbLsCfg *elbv2gw.ListenerConfiguration) (*elbv2model.Listener, error) {
9087
var listenerSpec *elbv2model.ListenerSpec
9188

9289
var err error
9390
if l.loadBalancerType == elbv2model.LoadBalancerTypeApplication {
9491
listenerSpec, err = l.buildL7ListenerSpec(ctx, lb, gw, lbCfg, port, gwLsCfg, lbLsCfg)
9592
} else {
96-
listenerSpec, err = l.buildL4ListenerSpec(ctx, stack, lb, securityGroups, gw, lbCfg, port, routes, gwLsCfg, lbLsCfg)
93+
listenerSpec, err = l.buildL4ListenerSpec(ctx, stack, lb, gw, lbCfg, port, routes, gwLsCfg, lbLsCfg)
9794
}
9895
if err != nil {
9996
return nil, err
@@ -150,7 +147,7 @@ func (l listenerBuilderImpl) buildL7ListenerSpec(ctx context.Context, lb *elbv2m
150147
return listenerSpec, nil
151148
}
152149

153-
func (l listenerBuilderImpl) buildL4ListenerSpec(ctx context.Context, stack core.Stack, lb *elbv2model.LoadBalancer, securityGroups securityGroupOutput, gw *gwv1.Gateway, lbCfg elbv2gw.LoadBalancerConfiguration, port int32, routes []routeutils.RouteDescriptor, gwLsCfg *gwListenerConfig, lbLsCfg *elbv2gw.ListenerConfiguration) (*elbv2model.ListenerSpec, error) {
150+
func (l listenerBuilderImpl) buildL4ListenerSpec(ctx context.Context, stack core.Stack, lb *elbv2model.LoadBalancer, gw *gwv1.Gateway, lbCfg elbv2gw.LoadBalancerConfiguration, port int32, routes []routeutils.RouteDescriptor, gwLsCfg *gwListenerConfig, lbLsCfg *elbv2gw.ListenerConfiguration) (*elbv2model.ListenerSpec, error) {
154151
listenerSpec, err := l.buildListenerSpec(ctx, lb, gw, port, lbCfg, gwLsCfg, lbLsCfg)
155152
if err != nil {
156153
return &elbv2model.ListenerSpec{}, err
@@ -180,15 +177,15 @@ func (l listenerBuilderImpl) buildL4ListenerSpec(ctx context.Context, stack core
180177
return nil, nil
181178
}
182179

183-
arn, tgErr := l.tgBuilder.buildTargetGroup(stack, gw, lbCfg, lb.Spec.IPAddressType, routeDescriptor, backend, securityGroups.backendSecurityGroupToken)
180+
arn, tgErr := l.tgBuilder.buildTargetGroup(stack, gw, lbCfg, lb.Spec.IPAddressType, routeDescriptor, backend)
184181
if tgErr != nil {
185182
return &elbv2model.ListenerSpec{}, tgErr
186183
}
187184
listenerSpec.DefaultActions = buildL4ListenerDefaultActions(arn)
188185
return listenerSpec, nil
189186
}
190187

191-
func (l listenerBuilderImpl) buildListenerRules(ctx context.Context, stack core.Stack, ls *elbv2model.Listener, ipAddressType elbv2model.IPAddressType, securityGroups securityGroupOutput, gw *gwv1.Gateway, port int32, lbCfg elbv2gw.LoadBalancerConfiguration, routes map[int32][]routeutils.RouteDescriptor) ([]types.NamespacedName, error) {
188+
func (l listenerBuilderImpl) buildListenerRules(ctx context.Context, stack core.Stack, ls *elbv2model.Listener, ipAddressType elbv2model.IPAddressType, gw *gwv1.Gateway, port int32, lbCfg elbv2gw.LoadBalancerConfiguration, routes map[int32][]routeutils.RouteDescriptor) ([]types.NamespacedName, error) {
192189
// sort all rules based on precedence
193190
rulesWithPrecedenceOrder := routeutils.SortAllRulesByPrecedence(routes[port])
194191
secrets := make([]types.NamespacedName, 0)
@@ -225,7 +222,7 @@ func (l listenerBuilderImpl) buildListenerRules(ctx context.Context, stack core.
225222
}
226223
targetGroupTuples := make([]elbv2model.TargetGroupTuple, 0, len(rule.GetBackends()))
227224
for _, backend := range rule.GetBackends() {
228-
arn, tgErr := l.tgBuilder.buildTargetGroup(stack, gw, lbCfg, ipAddressType, route, backend, securityGroups.backendSecurityGroupToken)
225+
arn, tgErr := l.tgBuilder.buildTargetGroup(stack, gw, lbCfg, ipAddressType, route, backend)
229226
if tgErr != nil {
230227
return nil, tgErr
231228
}

pkg/gateway/model/model_build_listener_test.go

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,6 @@ func Test_BuildListenerRules(t *testing.T) {
10591059
autheticateBehavior := elbv2gw.AuthenticateCognitoActionConditionalBehaviorEnumAuthenticate
10601060
testCases := []struct {
10611061
name string
1062-
sgOutput securityGroupOutput
10631062
ipAddressType elbv2model.IPAddressType
10641063
port int32
10651064
listenerProtocol elbv2model.Protocol
@@ -1074,9 +1073,6 @@ func Test_BuildListenerRules(t *testing.T) {
10741073
port: 80,
10751074
listenerProtocol: elbv2model.ProtocolHTTP,
10761075
ipAddressType: elbv2model.IPAddressTypeIPV4,
1077-
sgOutput: securityGroupOutput{
1078-
backendSecurityGroupToken: coremodel.LiteralStringToken("sg-B"),
1079-
},
10801076
routes: map[int32][]routeutils.RouteDescriptor{
10811077
80: {
10821078
&routeutils.MockRoute{
@@ -1128,9 +1124,6 @@ func Test_BuildListenerRules(t *testing.T) {
11281124
port: 80,
11291125
listenerProtocol: elbv2model.ProtocolHTTP,
11301126
ipAddressType: elbv2model.IPAddressTypeIPV4,
1131-
sgOutput: securityGroupOutput{
1132-
backendSecurityGroupToken: coremodel.LiteralStringToken("sg-B"),
1133-
},
11341127
routes: map[int32][]routeutils.RouteDescriptor{
11351128
80: {
11361129
&routeutils.MockRoute{
@@ -1195,9 +1188,6 @@ func Test_BuildListenerRules(t *testing.T) {
11951188
port: 80,
11961189
listenerProtocol: elbv2model.ProtocolHTTP,
11971190
ipAddressType: elbv2model.IPAddressTypeIPV4,
1198-
sgOutput: securityGroupOutput{
1199-
backendSecurityGroupToken: coremodel.LiteralStringToken("sg-B"),
1200-
},
12011191
routes: map[int32][]routeutils.RouteDescriptor{
12021192
80: {
12031193
&routeutils.MockRoute{
@@ -1267,9 +1257,6 @@ func Test_BuildListenerRules(t *testing.T) {
12671257
port: 80,
12681258
listenerProtocol: elbv2model.ProtocolHTTP,
12691259
ipAddressType: elbv2model.IPAddressTypeIPV4,
1270-
sgOutput: securityGroupOutput{
1271-
backendSecurityGroupToken: coremodel.LiteralStringToken("sg-B"),
1272-
},
12731260
routes: map[int32][]routeutils.RouteDescriptor{
12741261
80: {
12751262
&routeutils.MockRoute{
@@ -1345,9 +1332,6 @@ func Test_BuildListenerRules(t *testing.T) {
13451332
port: 80,
13461333
listenerProtocol: elbv2model.ProtocolHTTPS,
13471334
ipAddressType: elbv2model.IPAddressTypeIPV4,
1348-
sgOutput: securityGroupOutput{
1349-
backendSecurityGroupToken: coremodel.LiteralStringToken("sg-B"),
1350-
},
13511335
routes: map[int32][]routeutils.RouteDescriptor{
13521336
80: {
13531337
&routeutils.MockRoute{
@@ -1449,9 +1433,6 @@ func Test_BuildListenerRules(t *testing.T) {
14491433
port: 80,
14501434
listenerProtocol: elbv2model.ProtocolHTTPS,
14511435
ipAddressType: elbv2model.IPAddressTypeIPV4,
1452-
sgOutput: securityGroupOutput{
1453-
backendSecurityGroupToken: coremodel.LiteralStringToken("sg-B"),
1454-
},
14551436
routes: map[int32][]routeutils.RouteDescriptor{
14561437
80: {
14571438
&routeutils.MockRoute{
@@ -1546,7 +1527,7 @@ func Test_BuildListenerRules(t *testing.T) {
15461527
err: tc.tagErr,
15471528
}
15481529

1549-
mockTgBuilder := &MockTargetGroupBuilder{
1530+
mockTgBuilder := &mockTargetGroupBuilder{
15501531
tgs: []*elbv2model.TargetGroup{
15511532
{
15521533
ResourceMeta: coremodel.NewResourceMeta(stack, "AWS::ElasticLoadBalancingV2::TargetGroup", "id-1"),
@@ -1563,7 +1544,7 @@ func Test_BuildListenerRules(t *testing.T) {
15631544
Spec: elbv2model.ListenerSpec{
15641545
Protocol: tc.listenerProtocol,
15651546
},
1566-
}, tc.ipAddressType, tc.sgOutput, &gwv1.Gateway{}, tc.port, elbv2gw.LoadBalancerConfiguration{}, tc.routes)
1547+
}, tc.ipAddressType, &gwv1.Gateway{}, tc.port, elbv2gw.LoadBalancerConfiguration{}, tc.routes)
15671548
assert.NoError(t, err)
15681549

15691550
var resLRs []*elbv2model.ListenerRule

pkg/gateway/model/model_build_subnet.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717

1818
type buildLoadBalancerSubnetsOutput struct {
1919
subnets []elbv2model.SubnetMapping
20+
ec2Result []ec2types.Subnet
2021
sourceIPv6NatEnabled bool
2122
}
2223

@@ -97,6 +98,7 @@ func (subnetBuilder *subnetModelBuilderImpl) buildLoadBalancerSubnets(ctx contex
9798

9899
return buildLoadBalancerSubnetsOutput{
99100
subnets: result,
101+
ec2Result: resolvedEC2Subnets,
100102
sourceIPv6NatEnabled: sourceNATEnabled,
101103
}, nil
102104
}

0 commit comments

Comments
 (0)