diff --git a/errors/pointer.go b/errors/pointer.go index 94f1aca066cb..34ba6a7d07f0 100644 --- a/errors/pointer.go +++ b/errors/pointer.go @@ -17,16 +17,22 @@ limitations under the License. package errors // MachineStatusErrorPtr converts a MachineStatusError to a pointer. +// +// Deprecated: This function is deprecated and will be removed in an upcoming release of Cluster API. func MachineStatusErrorPtr(v MachineStatusError) *MachineStatusError { return &v } // MachinePoolStatusErrorPtr converts a MachinePoolStatusError to a pointer. +// +// Deprecated: This function is deprecated and will be removed in an upcoming release of Cluster API. func MachinePoolStatusErrorPtr(v MachinePoolStatusFailure) *MachinePoolStatusFailure { return &v } // ClusterStatusErrorPtr converts a MachineStatusError to a pointer. +// +// Deprecated: This function is deprecated and will be removed in an upcoming release of Cluster API. func ClusterStatusErrorPtr(v ClusterStatusError) *ClusterStatusError { return &v } diff --git a/exp/internal/controllers/machinepool_controller_phases.go b/exp/internal/controllers/machinepool_controller_phases.go index 486668a85cf6..1c7a9bb32cfb 100644 --- a/exp/internal/controllers/machinepool_controller_phases.go +++ b/exp/internal/controllers/machinepool_controller_phases.go @@ -252,7 +252,7 @@ func (r *MachinePoolReconciler) reconcileInfrastructure(ctx context.Context, clu if mp.Status.InfrastructureReady { // Infra object went missing after the machine pool was up and running log.Error(err, "infrastructure reference has been deleted after being ready, setting failure state") - mp.Status.FailureReason = capierrors.MachinePoolStatusErrorPtr(capierrors.InvalidConfigurationMachinePoolError) + mp.Status.FailureReason = ptr.To(capierrors.InvalidConfigurationMachinePoolError) mp.Status.FailureMessage = ptr.To(fmt.Sprintf("MachinePool infrastructure resource %v with name %q has been deleted after being ready", mp.Spec.Template.Spec.InfrastructureRef.GroupVersionKind(), mp.Spec.Template.Spec.InfrastructureRef.Name)) } diff --git a/internal/controllers/machine/machine_controller_phases.go b/internal/controllers/machine/machine_controller_phases.go index f24d38f02f9c..b76b837b7f3e 100644 --- a/internal/controllers/machine/machine_controller_phases.go +++ b/internal/controllers/machine/machine_controller_phases.go @@ -254,7 +254,7 @@ func (r *Reconciler) reconcileInfrastructure(ctx context.Context, s *scope) (ctr // Infra object went missing after the machine was up and running if m.Status.InfrastructureReady { log.Error(err, "Machine infrastructure reference has been deleted after being ready, setting failure state") - m.Status.FailureReason = capierrors.MachineStatusErrorPtr(capierrors.InvalidConfigurationMachineError) + m.Status.FailureReason = ptr.To(capierrors.InvalidConfigurationMachineError) m.Status.FailureMessage = ptr.To(fmt.Sprintf("Machine infrastructure resource %v with name %q has been deleted after being ready", m.Spec.InfrastructureRef.GroupVersionKind(), m.Spec.InfrastructureRef.Name)) return ctrl.Result{}, errors.Errorf("could not find %v %q for Machine %q in namespace %q, requeuing", m.Spec.InfrastructureRef.GroupVersionKind().String(), m.Spec.InfrastructureRef.Name, m.Name, m.Namespace)