@@ -64,6 +64,9 @@ const apiServerTargetGroupPrefix = "apiserver-target-"
64
64
// listeners.
65
65
const additionalTargetGroupPrefix = "additional-listener-"
66
66
67
+ // cantAttachSGToNLBRegions is a set of regions that do not support Security Groups in NLBs.
68
+ var cantAttachSGToNLBRegions = sets .New ("us-iso-east-1" , "us-iso-west-1" , "us-isob-east-1" )
69
+
67
70
// ReconcileLoadbalancers reconciles the load balancers for the given cluster.
68
71
func (s * Service ) ReconcileLoadbalancers () error {
69
72
s .scope .Debug ("Reconciling load balancers" )
@@ -395,6 +398,11 @@ func (s *Service) createLB(spec *infrav1.LoadBalancer, lbSpec *infrav1.AWSLoadBa
395
398
input .IpAddressType = aws .String ("dualstack" )
396
399
}
397
400
401
+ // TODO: remove when security groups on NLBs is supported in all regions.
402
+ if cantAttachSGToNLBRegions .Has (s .scope .Region ()) {
403
+ input .SecurityGroups = nil
404
+ }
405
+
398
406
// Allocate custom addresses (Elastic IP) to internet-facing Load Balancers, when defined.
399
407
// Custom, or BYO, Public IPv4 Pool need to be created prior install, and the Pool ID must be
400
408
// set in the VpcSpec.ElasticIPPool.PublicIPv4Pool to allow Elastic IP be consumed from
@@ -1788,7 +1796,11 @@ func shouldReconcileSGs(scope scope.ELBScope, lb *infrav1.LoadBalancer, specSGs
1788
1796
// Once created without a security group, the NLB can never have any added.
1789
1797
// (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-security-groups.html)
1790
1798
if lb .LoadBalancerType == infrav1 .LoadBalancerTypeNLB && len (lb .SecurityGroupIDs ) == 0 {
1791
- scope .Info ("Pre-existing NLB %s without security groups, cannot reconcile security groups." , lb .Name )
1799
+ if cantAttachSGToNLBRegions .Has (scope .Region ()) {
1800
+ scope .Info ("Region doesn't support NLB security groups, cannot reconcile security groups." , "region" , scope .Region (), "elb-name" , lb .Name )
1801
+ } else {
1802
+ scope .Info ("Pre-existing NLB without security groups, cannot reconcile security groups." , "elb-name" , lb .Name )
1803
+ }
1792
1804
return false
1793
1805
}
1794
1806
if ! sets .NewString (lb .SecurityGroupIDs ... ).Equal (sets .NewString (specSGs ... )) {
0 commit comments