Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 fix: additional control plane LBs must use correct schema/subnets #4840

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/cloud/scope/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func (s *ClusterScope) ControlPlaneLoadBalancers() []*infrav1.AWSLoadBalancerSpe
}

// ControlPlaneLoadBalancerScheme returns the Classic ELB scheme (public or internal facing).
// Deprecated: This method is going to be removed in a future release. Use LoadBalancer.Scheme.
mtulio marked this conversation as resolved.
Show resolved Hide resolved
func (s *ClusterScope) ControlPlaneLoadBalancerScheme() infrav1.ELBScheme {
if s.ControlPlaneLoadBalancer() != nil && s.ControlPlaneLoadBalancer().Scheme != nil {
return *s.ControlPlaneLoadBalancer().Scheme
Expand Down
1 change: 1 addition & 0 deletions pkg/cloud/scope/elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type ELBScope interface {
ControlPlaneLoadBalancer() *infrav1.AWSLoadBalancerSpec

// ControlPlaneLoadBalancerScheme returns the Classic ELB scheme (public or internal facing)
// Deprecated: This method is going to be removed in a future release. Use LoadBalancer.Scheme.
ControlPlaneLoadBalancerScheme() infrav1.ELBScheme

// ControlPlaneLoadBalancerName returns the Classic ELB name
Expand Down
11 changes: 8 additions & 3 deletions pkg/cloud/services/elb/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (s *Service) getAPIServerLBSpec(elbName string, lbSpec *infrav1.AWSLoadBala
// The load balancer APIs require us to only attach one subnet for each AZ.
subnets := s.scope.Subnets().FilterPrivate()

if s.scope.ControlPlaneLoadBalancerScheme() == infrav1.ELBSchemeInternetFacing {
if scheme == infrav1.ELBSchemeInternetFacing {
subnets = s.scope.Subnets().FilterPublic()
}

Expand Down Expand Up @@ -989,9 +989,14 @@ func (s *Service) getAPIServerClassicELBSpec(elbName string) (*infrav1.LoadBalan
}
securityGroupIDs = append(securityGroupIDs, s.scope.SecurityGroups()[infrav1.SecurityGroupAPIServerLB].ID)

scheme := infrav1.ELBSchemeInternetFacing
if controlPlaneLoadBalancer != nil && controlPlaneLoadBalancer.Scheme != nil {
scheme = *controlPlaneLoadBalancer.Scheme
}

res := &infrav1.LoadBalancer{
Name: elbName,
Scheme: s.scope.ControlPlaneLoadBalancerScheme(),
Scheme: scheme,
ClassicELBListeners: []infrav1.ClassicELBListener{
{
Protocol: infrav1.ELBProtocolTCP,
Expand Down Expand Up @@ -1044,7 +1049,7 @@ func (s *Service) getAPIServerClassicELBSpec(elbName string) (*infrav1.LoadBalan
// The load balancer APIs require us to only attach one subnet for each AZ.
subnets := s.scope.Subnets().FilterPrivate()

if s.scope.ControlPlaneLoadBalancerScheme() == infrav1.ELBSchemeInternetFacing {
if scheme == infrav1.ELBSchemeInternetFacing {
subnets = s.scope.Subnets().FilterPublic()
}

Expand Down