Skip to content

Commit 500cef6

Browse files
committed
Fix panic on delete before cluster is initialised
1 parent 2e29edc commit 500cef6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

controllers/openstackmachine_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,9 @@ func machineToInstanceSpec(openStackCluster *infrav1.OpenStackCluster, machine *
492492
instanceSpec.SecurityGroups = openStackMachine.Spec.SecurityGroups
493493
if openStackCluster.Spec.ManagedSecurityGroups {
494494
var managedSecurityGroup string
495-
if util.IsControlPlaneMachine(machine) {
495+
if util.IsControlPlaneMachine(machine) && openStackCluster.Status.ControlPlaneSecurityGroup != nil {
496496
managedSecurityGroup = openStackCluster.Status.ControlPlaneSecurityGroup.ID
497-
} else {
497+
} else if openStackCluster.Status.WorkerSecurityGroup != nil {
498498
managedSecurityGroup = openStackCluster.Status.WorkerSecurityGroup.ID
499499
}
500500

0 commit comments

Comments
 (0)