@@ -62,10 +62,11 @@ type loadBalancerConfig struct {
62
62
Name string
63
63
Tags map [string ]string
64
64
65
- Type * string
66
- Scheme * string
67
- IpAddressType * string
68
- Subnets []string
65
+ Type * string
66
+ Scheme * string
67
+ IpAddressType * string
68
+ SecurityGroups []string
69
+ Subnets []string
69
70
}
70
71
71
72
type defaultController struct {
@@ -184,12 +185,13 @@ func (controller *defaultController) ensureLBInstance(ctx context.Context, lbCon
184
185
func (controller * defaultController ) newLBInstance (ctx context.Context , lbConfig * loadBalancerConfig ) (* elbv2.LoadBalancer , error ) {
185
186
albctx .GetLogger (ctx ).Infof ("creating LoadBalancer %v" , lbConfig .Name )
186
187
resp , err := controller .cloud .CreateLoadBalancerWithContext (ctx , & elbv2.CreateLoadBalancerInput {
187
- Name : aws .String (lbConfig .Name ),
188
- Type : lbConfig .Type ,
189
- Scheme : lbConfig .Scheme ,
190
- IpAddressType : lbConfig .IpAddressType ,
191
- Subnets : aws .StringSlice (lbConfig .Subnets ),
192
- Tags : tags .ConvertToELBV2 (lbConfig .Tags ),
188
+ Name : aws .String (lbConfig .Name ),
189
+ Type : lbConfig .Type ,
190
+ Scheme : lbConfig .Scheme ,
191
+ IpAddressType : lbConfig .IpAddressType ,
192
+ SecurityGroups : aws .StringSlice (lbConfig .SecurityGroups ),
193
+ Subnets : aws .StringSlice (lbConfig .Subnets ),
194
+ Tags : tags .ConvertToELBV2 (lbConfig .Tags ),
193
195
})
194
196
if err != nil {
195
197
albctx .GetLogger (ctx ).Errorf ("failed to create LoadBalancer %v due to %v" , lbConfig .Name , err )
@@ -309,10 +311,11 @@ func (controller *defaultController) buildLBConfig(ctx context.Context, ingress
309
311
Name : controller .nameTagGen .NameLB (ingress .Namespace , ingress .Name ),
310
312
Tags : lbTags ,
311
313
312
- Type : aws .String (elbv2 .LoadBalancerTypeEnumApplication ),
313
- Scheme : ingressAnnos .LoadBalancer .Scheme ,
314
- IpAddressType : ingressAnnos .LoadBalancer .IPAddressType ,
315
- Subnets : subnets ,
314
+ Type : aws .String (elbv2 .LoadBalancerTypeEnumApplication ),
315
+ Scheme : ingressAnnos .LoadBalancer .Scheme ,
316
+ IpAddressType : ingressAnnos .LoadBalancer .IPAddressType ,
317
+ SecurityGroups : ingressAnnos .LoadBalancer .SecurityGroups ,
318
+ Subnets : subnets ,
316
319
}, nil
317
320
}
318
321
0 commit comments