Skip to content

Commit 4860e26

Browse files
committed
svc/nlb/sg: ensure v2 is hsndling security group IDs on Create
Ensure the Security Group IDs is added on NLB load balancer creation.
1 parent a24e507 commit 4860e26

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/providers/v1/aws_loadbalancer.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func getKeyValuePropertiesFromAnnotation(annotations map[string]string, annotati
142142
}
143143

144144
// ensureLoadBalancerv2 ensures a v2 load balancer is created
145-
func (c *Cloud) ensureLoadBalancerv2(namespacedName types.NamespacedName, loadBalancerName string, mappings []nlbPortMapping, instanceIDs, discoveredSubnetIDs []string, internalELB bool, annotations map[string]string) (*elbv2.LoadBalancer, error) {
145+
func (c *Cloud) ensureLoadBalancerv2(namespacedName types.NamespacedName, loadBalancerName string, mappings []nlbPortMapping, instanceIDs, discoveredSubnetIDs []string, internalELB bool, annotations map[string]string, securityGroups []*string) (*elbv2.LoadBalancer, error) {
146146
loadBalancer, err := c.describeLoadBalancerv2(loadBalancerName)
147147
if err != nil {
148148
return nil, err
@@ -178,6 +178,9 @@ func (c *Cloud) ensureLoadBalancerv2(namespacedName types.NamespacedName, loadBa
178178
// TODO: What happens if we have more than one subnet per AZ?
179179
createRequest.SubnetMappings = createSubnetMappings(discoveredSubnetIDs, allocationIDs)
180180

181+
// Enable provisioning NLB with security groups when the annotation(s) are set.
182+
createRequest.SecurityGroups = securityGroups
183+
181184
for k, v := range tags {
182185
createRequest.Tags = append(createRequest.Tags, &elbv2.Tag{
183186
Key: aws.String(k), Value: aws.String(v),

0 commit comments

Comments
 (0)