Skip to content

Commit

Permalink
Merge pull request #4566 from vincepri/elbv2tags
Browse files Browse the repository at this point in the history
🐛 ELBv2 target groups should inherit tags
  • Loading branch information
k8s-ci-robot authored Oct 11, 2023
2 parents 35f8bec + db4a0da commit ba876fa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/cloud/services/elb/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ func (s *Service) createLB(spec *infrav1.LoadBalancer) (*infrav1.LoadBalancer, e
Port: aws.Int64(ln.TargetGroup.Port),
Protocol: aws.String(ln.TargetGroup.Protocol.String()),
VpcId: aws.String(ln.TargetGroup.VpcID),
Tags: input.Tags,
}
if s.scope.VPC().IsIPv6Enabled() {
targetGroupInput.IpAddressType = aws.String("ipv6")
Expand Down
30 changes: 30 additions & 0 deletions pkg/cloud/services/elb/loadbalancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,12 @@ func TestCreateNLB(t *testing.T) {
Port: aws.Int64(infrav1.DefaultAPIServerPort),
Protocol: aws.String("TCP"),
VpcId: aws.String(vpcID),
Tags: []*elbv2.Tag{
{
Key: aws.String("test"),
Value: aws.String("tag"),
},
},
})).Return(&elbv2.CreateTargetGroupOutput{
TargetGroups: []*elbv2.TargetGroup{
{
Expand Down Expand Up @@ -1143,6 +1149,12 @@ func TestCreateNLB(t *testing.T) {
Protocol: aws.String("TCP"),
VpcId: aws.String(vpcID),
IpAddressType: aws.String("ipv6"),
Tags: []*elbv2.Tag{
{
Key: aws.String("test"),
Value: aws.String("tag"),
},
},
})).Return(&elbv2.CreateTargetGroupOutput{
TargetGroups: []*elbv2.TargetGroup{
{
Expand Down Expand Up @@ -1274,6 +1286,12 @@ func TestCreateNLB(t *testing.T) {
Port: aws.Int64(infrav1.DefaultAPIServerPort),
Protocol: aws.String("TCP"),
VpcId: aws.String(vpcID),
Tags: []*elbv2.Tag{
{
Key: aws.String("test"),
Value: aws.String("tag"),
},
},
})).Return(&elbv2.CreateTargetGroupOutput{
TargetGroups: []*elbv2.TargetGroup{
{
Expand Down Expand Up @@ -1365,6 +1383,12 @@ func TestCreateNLB(t *testing.T) {
Port: aws.Int64(infrav1.DefaultAPIServerPort),
Protocol: aws.String("TCP"),
VpcId: aws.String(vpcID),
Tags: []*elbv2.Tag{
{
Key: aws.String("test"),
Value: aws.String("tag"),
},
},
})).Return(&elbv2.CreateTargetGroupOutput{
TargetGroups: []*elbv2.TargetGroup{
{
Expand Down Expand Up @@ -1449,6 +1473,12 @@ func TestCreateNLB(t *testing.T) {
Port: aws.Int64(infrav1.DefaultAPIServerPort),
Protocol: aws.String("TCP"),
VpcId: aws.String(vpcID),
Tags: []*elbv2.Tag{
{
Key: aws.String("test"),
Value: aws.String("tag"),
},
},
})).Return(&elbv2.CreateTargetGroupOutput{
TargetGroups: []*elbv2.TargetGroup{
{
Expand Down

0 comments on commit ba876fa

Please sign in to comment.