Skip to content

Commit ba876fa

Browse files
authored
Merge pull request #4566 from vincepri/elbv2tags
🐛 ELBv2 target groups should inherit tags
2 parents 35f8bec + db4a0da commit ba876fa

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

pkg/cloud/services/elb/loadbalancer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ func (s *Service) createLB(spec *infrav1.LoadBalancer) (*infrav1.LoadBalancer, e
273273
Port: aws.Int64(ln.TargetGroup.Port),
274274
Protocol: aws.String(ln.TargetGroup.Protocol.String()),
275275
VpcId: aws.String(ln.TargetGroup.VpcID),
276+
Tags: input.Tags,
276277
}
277278
if s.scope.VPC().IsIPv6Enabled() {
278279
targetGroupInput.IpAddressType = aws.String("ipv6")

pkg/cloud/services/elb/loadbalancer_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,12 @@ func TestCreateNLB(t *testing.T) {
10471047
Port: aws.Int64(infrav1.DefaultAPIServerPort),
10481048
Protocol: aws.String("TCP"),
10491049
VpcId: aws.String(vpcID),
1050+
Tags: []*elbv2.Tag{
1051+
{
1052+
Key: aws.String("test"),
1053+
Value: aws.String("tag"),
1054+
},
1055+
},
10501056
})).Return(&elbv2.CreateTargetGroupOutput{
10511057
TargetGroups: []*elbv2.TargetGroup{
10521058
{
@@ -1143,6 +1149,12 @@ func TestCreateNLB(t *testing.T) {
11431149
Protocol: aws.String("TCP"),
11441150
VpcId: aws.String(vpcID),
11451151
IpAddressType: aws.String("ipv6"),
1152+
Tags: []*elbv2.Tag{
1153+
{
1154+
Key: aws.String("test"),
1155+
Value: aws.String("tag"),
1156+
},
1157+
},
11461158
})).Return(&elbv2.CreateTargetGroupOutput{
11471159
TargetGroups: []*elbv2.TargetGroup{
11481160
{
@@ -1274,6 +1286,12 @@ func TestCreateNLB(t *testing.T) {
12741286
Port: aws.Int64(infrav1.DefaultAPIServerPort),
12751287
Protocol: aws.String("TCP"),
12761288
VpcId: aws.String(vpcID),
1289+
Tags: []*elbv2.Tag{
1290+
{
1291+
Key: aws.String("test"),
1292+
Value: aws.String("tag"),
1293+
},
1294+
},
12771295
})).Return(&elbv2.CreateTargetGroupOutput{
12781296
TargetGroups: []*elbv2.TargetGroup{
12791297
{
@@ -1365,6 +1383,12 @@ func TestCreateNLB(t *testing.T) {
13651383
Port: aws.Int64(infrav1.DefaultAPIServerPort),
13661384
Protocol: aws.String("TCP"),
13671385
VpcId: aws.String(vpcID),
1386+
Tags: []*elbv2.Tag{
1387+
{
1388+
Key: aws.String("test"),
1389+
Value: aws.String("tag"),
1390+
},
1391+
},
13681392
})).Return(&elbv2.CreateTargetGroupOutput{
13691393
TargetGroups: []*elbv2.TargetGroup{
13701394
{
@@ -1449,6 +1473,12 @@ func TestCreateNLB(t *testing.T) {
14491473
Port: aws.Int64(infrav1.DefaultAPIServerPort),
14501474
Protocol: aws.String("TCP"),
14511475
VpcId: aws.String(vpcID),
1476+
Tags: []*elbv2.Tag{
1477+
{
1478+
Key: aws.String("test"),
1479+
Value: aws.String("tag"),
1480+
},
1481+
},
14521482
})).Return(&elbv2.CreateTargetGroupOutput{
14531483
TargetGroups: []*elbv2.TargetGroup{
14541484
{

0 commit comments

Comments
 (0)