@@ -250,7 +250,7 @@ func (s *Service) getAPIServerLBSpec(elbName string, lbSpec *infrav1.AWSLoadBala
250250 // The load balancer APIs require us to only attach one subnet for each AZ.
251251 subnets := s .scope .Subnets ().FilterPrivate ()
252252
253- if s . scope . ControlPlaneLoadBalancerScheme () == infrav1 .ELBSchemeInternetFacing {
253+ if scheme == infrav1 .ELBSchemeInternetFacing {
254254 subnets = s .scope .Subnets ().FilterPublic ()
255255 }
256256
@@ -989,9 +989,14 @@ func (s *Service) getAPIServerClassicELBSpec(elbName string) (*infrav1.LoadBalan
989989 }
990990 securityGroupIDs = append (securityGroupIDs , s .scope .SecurityGroups ()[infrav1 .SecurityGroupAPIServerLB ].ID )
991991
992+ scheme := infrav1 .ELBSchemeInternetFacing
993+ if controlPlaneLoadBalancer != nil && controlPlaneLoadBalancer .Scheme != nil {
994+ scheme = * controlPlaneLoadBalancer .Scheme
995+ }
996+
992997 res := & infrav1.LoadBalancer {
993998 Name : elbName ,
994- Scheme : s . scope . ControlPlaneLoadBalancerScheme () ,
999+ Scheme : scheme ,
9951000 ClassicELBListeners : []infrav1.ClassicELBListener {
9961001 {
9971002 Protocol : infrav1 .ELBProtocolTCP ,
@@ -1044,7 +1049,7 @@ func (s *Service) getAPIServerClassicELBSpec(elbName string) (*infrav1.LoadBalan
10441049 // The load balancer APIs require us to only attach one subnet for each AZ.
10451050 subnets := s .scope .Subnets ().FilterPrivate ()
10461051
1047- if s . scope . ControlPlaneLoadBalancerScheme () == infrav1 .ELBSchemeInternetFacing {
1052+ if scheme == infrav1 .ELBSchemeInternetFacing {
10481053 subnets = s .scope .Subnets ().FilterPublic ()
10491054 }
10501055
0 commit comments