@@ -250,7 +250,7 @@ func (s *Service) getAPIServerLBSpec(elbName string, lbSpec *infrav1.AWSLoadBala
250
250
// The load balancer APIs require us to only attach one subnet for each AZ.
251
251
subnets := s .scope .Subnets ().FilterPrivate ()
252
252
253
- if s . scope . ControlPlaneLoadBalancerScheme () == infrav1 .ELBSchemeInternetFacing {
253
+ if scheme == infrav1 .ELBSchemeInternetFacing {
254
254
subnets = s .scope .Subnets ().FilterPublic ()
255
255
}
256
256
@@ -989,9 +989,14 @@ func (s *Service) getAPIServerClassicELBSpec(elbName string) (*infrav1.LoadBalan
989
989
}
990
990
securityGroupIDs = append (securityGroupIDs , s .scope .SecurityGroups ()[infrav1 .SecurityGroupAPIServerLB ].ID )
991
991
992
+ scheme := infrav1 .ELBSchemeInternetFacing
993
+ if controlPlaneLoadBalancer != nil && controlPlaneLoadBalancer .Scheme != nil {
994
+ scheme = * controlPlaneLoadBalancer .Scheme
995
+ }
996
+
992
997
res := & infrav1.LoadBalancer {
993
998
Name : elbName ,
994
- Scheme : s . scope . ControlPlaneLoadBalancerScheme () ,
999
+ Scheme : scheme ,
995
1000
ClassicELBListeners : []infrav1.ClassicELBListener {
996
1001
{
997
1002
Protocol : infrav1 .ELBProtocolTCP ,
@@ -1044,7 +1049,7 @@ func (s *Service) getAPIServerClassicELBSpec(elbName string) (*infrav1.LoadBalan
1044
1049
// The load balancer APIs require us to only attach one subnet for each AZ.
1045
1050
subnets := s .scope .Subnets ().FilterPrivate ()
1046
1051
1047
- if s . scope . ControlPlaneLoadBalancerScheme () == infrav1 .ELBSchemeInternetFacing {
1052
+ if scheme == infrav1 .ELBSchemeInternetFacing {
1048
1053
subnets = s .scope .Subnets ().FilterPublic ()
1049
1054
}
1050
1055
0 commit comments