Skip to content

Commit 022e20c

Browse files
authored
Merge pull request #1657 from shiftstack/issue1654
🐛 Fix panic on delete before cluster is initialised
2 parents cc25810 + 500cef6 commit 022e20c

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)