Skip to content

Commit

Permalink
fix: Add condition to AddToLBIfNeeded which checks if API server lb i…
Browse files Browse the repository at this point in the history
…s enabled
  • Loading branch information
hrak committed Aug 13, 2024
1 parent 0e9a10a commit bc2002e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions controllers/cloudstackmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,11 @@ func (r *CloudStackMachineReconciliationRunner) RequeueIfInstanceNotRunning() (r
return ctrl.Result{}, nil
}

// AddToLBIfNeeded adds instance to load balancer if it is a control plane in an isolated network.
// AddToLBIfNeeded adds instance to load balancer if it is a control plane node in an isolated network, and the load balancer is enabled.
func (r *CloudStackMachineReconciliationRunner) AddToLBIfNeeded() (retRes ctrl.Result, reterr error) {
if util.IsControlPlaneMachine(r.CAPIMachine) && r.FailureDomain.Spec.Zone.Network.Type == cloud.NetworkTypeIsolated {
if util.IsControlPlaneMachine(r.CAPIMachine) &&
r.FailureDomain.Spec.Zone.Network.Type == cloud.NetworkTypeIsolated &&
r.CSCluster.Spec.APIServerLoadBalancer.IsEnabled() {
r.Log.Info("Assigning VM to load balancer rule.")
if r.IsoNet.Spec.Name == "" {
return r.RequeueWithMessage("Could not get required Isolated Network for VM, requeueing.")
Expand Down

0 comments on commit bc2002e

Please sign in to comment.