Skip to content

Commit

Permalink
fix: Only remove load balancer origins on control plane nodes
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Privitere <23177737+cprivitere@users.noreply.github.com>
  • Loading branch information
cprivitere committed Jun 24, 2024
1 parent 6accec5 commit 4ac085a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions controllers/packetmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,13 @@ func (r *PacketMachineReconciler) reconcileDelete(ctx context.Context, machineSc
}

if machineScope.PacketCluster.Spec.VIPManager == infrav1.EMLBVIPID {
// Create new EMLB object
lb := emlb.NewEMLB(r.PacketClient.GetConfig().DefaultHeader["X-Auth-Token"], machineScope.PacketCluster.Spec.ProjectID, packetmachine.Spec.Metro)
if machineScope.IsControlPlane() {
// Create new EMLB object
lb := emlb.NewEMLB(r.PacketClient.GetConfig().DefaultHeader["X-Auth-Token"], machineScope.PacketCluster.Spec.ProjectID, packetmachine.Spec.Metro)

if err := lb.DeleteLoadBalancerOrigin(ctx, machineScope); err != nil {
return fmt.Errorf("failed to delete load balancer origin: %w", err)
if err := lb.DeleteLoadBalancerOrigin(ctx, machineScope); err != nil {
return fmt.Errorf("failed to delete load balancer origin: %w", err)
}
}
}

Expand Down

0 comments on commit 4ac085a

Please sign in to comment.