diff --git a/controllers/machine_controller.go b/controllers/machine_controller.go index 577d0163776c..af0c11c97992 100644 --- a/controllers/machine_controller.go +++ b/controllers/machine_controller.go @@ -376,13 +376,10 @@ func (r *MachineReconciler) isDeleteNodeAllowed(ctx context.Context, cluster *cl return errNilNodeRef } - var controlPlane *unstructured.Unstructured - // controlPlaneRef is an optional field in the Cluster so skip the external // managed control plane check if it is nil if cluster.Spec.ControlPlaneRef != nil { - var err error - controlPlane, err = external.Get(ctx, r.Client, cluster.Spec.ControlPlaneRef, cluster.Spec.ControlPlaneRef.Namespace) + controlPlane, err := external.Get(ctx, r.Client, cluster.Spec.ControlPlaneRef, cluster.Spec.ControlPlaneRef.Namespace) if err != nil { return err }