Skip to content

Commit 22ba316

Browse files
committed
flip the conditional check just in case InstanceGeneration doesn't get set for existing LinodeMachines
1 parent f6ed3ee commit 22ba316

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

internal/controller/linodemachine_controller.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -791,13 +791,7 @@ func (r *LinodeMachineReconciler) reconcileFirewallID(ctx context.Context, logge
791791
)
792792
// Get the instance's firewalls normally if this is not using the new linode interfaces,
793793
// otherwise we have to get firewalls per linode interface
794-
if machineScope.LinodeMachine.Spec.InterfaceGeneration == linodego.GenerationLegacyConfig {
795-
firewalls, err = machineScope.LinodeClient.ListInstanceFirewalls(ctx, instanceID, nil)
796-
if err != nil {
797-
logger.Error(err, "Failed to list firewalls for Linode instance")
798-
return ctrl.Result{RequeueAfter: reconciler.DefaultMachineControllerWaitForRunningDelay}, nil
799-
}
800-
} else {
794+
if machineScope.LinodeMachine.Spec.InterfaceGeneration == linodego.GenerationLinode {
801795
interfaces, err := machineScope.LinodeClient.ListInterfaces(ctx, instanceID, nil)
802796
if err != nil {
803797
logger.Error(err, "Failed to list interfaces for Linode instance")
@@ -811,6 +805,12 @@ func (r *LinodeMachineReconciler) reconcileFirewallID(ctx context.Context, logge
811805
}
812806
firewalls = append(firewalls, ifaceFWs...)
813807
}
808+
} else {
809+
firewalls, err = machineScope.LinodeClient.ListInstanceFirewalls(ctx, instanceID, nil)
810+
if err != nil {
811+
logger.Error(err, "Failed to list firewalls for Linode instance")
812+
return ctrl.Result{RequeueAfter: reconciler.DefaultMachineControllerWaitForRunningDelay}, nil
813+
}
814814
}
815815

816816
attachedFWIDs := make([]int, 0, len(firewalls))

0 commit comments

Comments
 (0)