Skip to content

Commit

Permalink
Support bootstrap only additional listener
Browse files Browse the repository at this point in the history
Add an option to the AdditionalListenerSpec to signify that this pool
should only contain the boostrap node.  An example of this would be for
port 22 since every master node also has ssh but we need the public
load balance to only connect to the bootstrap ssh server.
  • Loading branch information
hamzy committed Nov 22, 2024
1 parent 8460807 commit 375cf4a
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 1 deletion.
4 changes: 4 additions & 0 deletions api/v1beta2/ibmvpccluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ type AdditionalListenerSpec struct {
// Will default to TCP protocol if not specified.
// +optional
Protocol *VPCLoadBalancerListenerProtocol `json:"protocol,omitempty"`

// BootstrapOnly signifies that only the bootstrap IP will be added to this pool.
// +optional
BootstrapOnly bool `json:"bootstrapOnly,omitempty"`
}

// VPCLoadBalancerBackendPoolSpec defines the desired configuration of a VPC Load Balancer Backend Pool.
Expand Down
10 changes: 10 additions & 0 deletions cloud/scope/powervs_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,16 @@ func (m *PowerVSMachineScope) CreateVPCLoadBalancerPoolMember() (*vpcv1.LoadBala
}
}
}

for _, al := range lb.AdditionalListeners {
ib := strings.Contains(m.IBMPowerVSMachine.Name, "-bootstrap")
if al.BootstrapOnly && al.Port == targetPort && !ib {
m.V(3).Info("Skipping PoolMember because BootstrapOnly specified")
alreadyRegistered = true
continue
}
}

if alreadyRegistered {
m.V(3).Info("PoolMember already exist", "pool", *pool.Name, "targetip", internalIP, "port", targetPort)
continue
Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/vpc_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ func (s *VPCClusterScope) createLoadBalancer(loadBalancer infrav1beta2.VPCLoadBa
for _, additionalListener := range loadBalancer.AdditionalListeners {
listener := s.buildLoadBalancerListener(additionalListener)

s.V(3).Info("addd listener to load balancer", "loadBalancerName", loadBalancer.Name, "listenerPort", listener.Port)
s.V(3).Info("added listener to load balancer", "loadBalancerName", loadBalancer.Name, "listenerPort", listener.Port)
listeners = append(listeners, listener)
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ spec:
AdditionalListenerSpec defines the desired state of an
additional listener on an VPC load balancer.
properties:
bootstrapOnly:
description: BootstrapOnly signifies that only the bootstrap
IP will be added to this pool.
type: boolean
defaultPoolName:
description: defaultPoolName defines the name of a VPC
Load Balancer Backend Pool to use for the VPC Load Balancer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ spec:
AdditionalListenerSpec defines the desired state of an
additional listener on an VPC load balancer.
properties:
bootstrapOnly:
description: BootstrapOnly signifies that only
the bootstrap IP will be added to this pool.
type: boolean
defaultPoolName:
description: defaultPoolName defines the name
of a VPC Load Balancer Backend Pool to use for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ spec:
AdditionalListenerSpec defines the desired state of an
additional listener on an VPC load balancer.
properties:
bootstrapOnly:
description: BootstrapOnly signifies that only the bootstrap
IP will be added to this pool.
type: boolean
defaultPoolName:
description: defaultPoolName defines the name of a VPC Load
Balancer Backend Pool to use for the VPC Load Balancer
Expand Down Expand Up @@ -532,6 +536,10 @@ spec:
AdditionalListenerSpec defines the desired state of an
additional listener on an VPC load balancer.
properties:
bootstrapOnly:
description: BootstrapOnly signifies that only the
bootstrap IP will be added to this pool.
type: boolean
defaultPoolName:
description: defaultPoolName defines the name of a
VPC Load Balancer Backend Pool to use for the VPC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ spec:
AdditionalListenerSpec defines the desired state of an
additional listener on an VPC load balancer.
properties:
bootstrapOnly:
description: BootstrapOnly signifies that only the
bootstrap IP will be added to this pool.
type: boolean
defaultPoolName:
description: defaultPoolName defines the name of
a VPC Load Balancer Backend Pool to use for the
Expand Down Expand Up @@ -389,6 +393,11 @@ spec:
AdditionalListenerSpec defines the desired state of an
additional listener on an VPC load balancer.
properties:
bootstrapOnly:
description: BootstrapOnly signifies that
only the bootstrap IP will be added to this
pool.
type: boolean
defaultPoolName:
description: defaultPoolName defines the name
of a VPC Load Balancer Backend Pool to use
Expand Down

0 comments on commit 375cf4a

Please sign in to comment.