@@ -168,16 +168,11 @@ func (r *LinodeMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
168168 return ctrl.Result {}, fmt .Errorf ("failed to create machine scope: %w" , err )
169169 }
170170
171- if isPaused , _ , err := paused .EnsurePausedCondition (ctx , machineScope .Client , machineScope .Cluster , machineScope .LinodeMachine ); err != nil {
172- if isPaused {
173- log .Info ("LinodeMachine or linked cluster is marked as paused, won't reconcile." )
174- return ctrl.Result {}, nil
175- }
171+ isPaused , _ , err := paused .EnsurePausedCondition (ctx , machineScope .Client , machineScope .Cluster , machineScope .LinodeMachine )
172+ if err != nil {
176173 return ctrl.Result {}, err
177174 }
178-
179- // Stop if paused
180- if reconciler .IsPaused (machineScope .Cluster , machineScope .Machine ) {
175+ if isPaused {
181176 log .Info ("LinodeMachine or linked cluster is marked as paused, won't reconcile." )
182177 return ctrl.Result {}, nil
183178 }
@@ -208,7 +203,7 @@ func (r *LinodeMachineReconciler) reconcileFirewallLabel(ctx context.Context, lo
208203 if _ , ok := labels [clusterv1 .ClusterNameLabel ]; ok {
209204 return nil
210205 }
211- labels [clusterv1 .ClusterNameLabel ] = machineScope .Machine . Labels [ clusterv1 . ClusterNameLabel ]
206+ labels [clusterv1 .ClusterNameLabel ] = machineScope .Cluster . Name
212207 linodeFW .SetLabels (labels )
213208 return retry .RetryOnConflict (retry .DefaultRetry , func () error {
214209 return machineScope .Client .Update (ctx , & linodeFW )
@@ -237,7 +232,7 @@ func (r *LinodeMachineReconciler) reconcilePGLabel(ctx context.Context, logger l
237232 if _ , ok := labels [clusterv1 .ClusterNameLabel ]; ok {
238233 return nil
239234 }
240- labels [clusterv1 .ClusterNameLabel ] = machineScope .Machine . Labels [ clusterv1 . ClusterNameLabel ]
235+ labels [clusterv1 .ClusterNameLabel ] = machineScope .Cluster . Name
241236 linodePG .ObjectMeta .SetLabels (labels )
242237 return retry .RetryOnConflict (retry .DefaultRetry , func () error {
243238 return machineScope .Client .Update (ctx , & linodePG )
@@ -247,6 +242,10 @@ func (r *LinodeMachineReconciler) reconcilePGLabel(ctx context.Context, logger l
247242// reconcileLabel adds the cluster-name label to placement groups and firewalls that are difference in the machine spec
248243// to ensure that they are represented as part of the cluster
249244func (r * LinodeMachineReconciler ) reconcileLabels (ctx context.Context , logger logr.Logger , machineScope * scope.MachineScope ) error {
245+ if machineScope .Cluster == nil {
246+ logger .Info ("Skipping firewall and pg labels due to missing capi cluster ref" )
247+ return nil
248+ }
250249 if err := r .reconcilePGLabel (ctx , logger , machineScope ); err != nil {
251250 return fmt .Errorf ("failed to label referenced placement group: %w" , err )
252251 }
0 commit comments