Skip to content

Commit 5c38172

Browse files
authored
Merge pull request #4182 from zac-nixon/main
[bug fix] fix tls protocol not being detected when generating SG rules
2 parents 2d66bb1 + 19ba368 commit 5c38172

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

pkg/service/model_build_target_group.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ func (t *defaultModelBuildTask) buildTargetGroupBindingSpec(ctx context.Context,
479479

480480
func (t *defaultModelBuildTask) buildTargetGroupBindingNetworking(_ context.Context, tgPort intstr.IntOrString,
481481
hcPort intstr.IntOrString, tgProtocol elbv2model.Protocol) (*elbv2model.TargetGroupBindingNetworking, error) {
482+
482483
if t.backendSGIDToken == nil {
483484
return nil, nil
484485
}
@@ -499,6 +500,8 @@ func (t *defaultModelBuildTask) buildTargetGroupBindingNetworking(_ context.Cont
499500
}
500501
} else {
501502
switch tgProtocol {
503+
case elbv2model.ProtocolTLS:
504+
fallthrough
502505
case elbv2model.ProtocolTCP:
503506
ports = append(ports, elbv2api.NetworkingPort{
504507
Protocol: &protocolTCP,

pkg/service/model_build_target_group_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,30 @@ func Test_defaultModelBuilderTask_buildTargetGroupBindingNetworking(t *testing.T
14321432
},
14331433
},
14341434
},
1435+
{
1436+
name: "tls with port restricted rules",
1437+
tgPort: port80,
1438+
hcPort: trafficPort,
1439+
tgProtocol: elbv2.ProtocolTLS,
1440+
backendSGIDToken: core.LiteralStringToken(sgBackend),
1441+
want: &elbv2.TargetGroupBindingNetworking{
1442+
Ingress: []elbv2.NetworkingIngressRule{
1443+
{
1444+
From: []elbv2.NetworkingPeer{
1445+
{
1446+
SecurityGroup: &elbv2.SecurityGroup{GroupID: core.LiteralStringToken(sgBackend)},
1447+
},
1448+
},
1449+
Ports: []elbv2api.NetworkingPort{
1450+
{
1451+
Protocol: &networkingProtocolTCP,
1452+
Port: &port80,
1453+
},
1454+
},
1455+
},
1456+
},
1457+
},
1458+
},
14351459
{
14361460
name: "udp with port restricted rules",
14371461
tgPort: port80,

0 commit comments

Comments
 (0)