Skip to content

Commit

Permalink
renamed struct field
Browse files Browse the repository at this point in the history
  • Loading branch information
lubedacht committed Jan 15, 2024
1 parent 11f51a1 commit ae0ee97
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions internal/controller/ionoscloudmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (r *IonosCloudMachineReconciler) isInfrastructureReady(machineScope *scope.
if !machineScope.Cluster.Status.InfrastructureReady {
machineScope.Info("Cluster infrastructure is not ready yet")
conditions.MarkFalse(
machineScope.IonosCloudMachine,
machineScope.IonosMachine,
infrav1.MachineProvisionedCondition,
infrav1.WaitingForClusterInfrastructureReason,
clusterv1.ConditionSeverityInfo, "")
Expand All @@ -157,7 +157,7 @@ func (r *IonosCloudMachineReconciler) isInfrastructureReady(machineScope *scope.
if machineScope.Machine.Spec.Bootstrap.DataSecretName == nil {
machineScope.Info("Bootstrap data secret is not available yet")
conditions.MarkFalse(
machineScope.IonosCloudMachine,
machineScope.IonosMachine,
infrav1.MachineProvisionedCondition,
infrav1.WaitingForBootstrapDataReason,
clusterv1.ConditionSeverityInfo, "",
Expand All @@ -181,7 +181,7 @@ func (r *IonosCloudMachineReconciler) reconcileNormal(machineScope *scope.Machin
return ctrl.Result{}, nil
}

if controllerutil.AddFinalizer(machineScope.IonosCloudMachine, infrav1.MachineFinalizer) {
if controllerutil.AddFinalizer(machineScope.IonosMachine, infrav1.MachineFinalizer) {
if err := machineScope.PatchObject(); err != nil {
machineScope.Error(err, "unable to update finalizer on object")
return ctrl.Result{}, err
Expand Down
2 changes: 1 addition & 1 deletion internal/service/cloud/datacenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ package cloud

// dataCenterID is a shortcut for getting the data center ID used by the IONOS Cloud machine.
func (s *Service) dataCenterID() string {
return s.scope.IonosCloudMachine.Spec.DataCenterID
return s.scope.IonosMachine.Spec.DataCenterID
}
24 changes: 12 additions & 12 deletions scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ type MachineScope struct {
Cluster *clusterv1.Cluster
Machine *clusterv1.Machine

ClusterScope *ClusterScope
IonosCloudMachine *infrav1.IonosCloudMachine
ClusterScope *ClusterScope
IonosMachine *infrav1.IonosCloudMachine
}

// MachineScopeParams is a struct that contains the params used to create a new MachineScope through NewMachineScope.
Expand Down Expand Up @@ -84,26 +84,26 @@ func NewMachineScope(params MachineScopeParams) (*MachineScope, error) {
return nil, fmt.Errorf("failed to init patch helper: %w", err)
}
return &MachineScope{
Logger: params.Logger,
client: params.Client,
patchHelper: helper,
Cluster: params.Cluster,
Machine: params.Machine,
ClusterScope: params.InfraCluster,
IonosCloudMachine: params.IonosMachine,
Logger: params.Logger,
client: params.Client,
patchHelper: helper,
Cluster: params.Cluster,
Machine: params.Machine,
ClusterScope: params.InfraCluster,
IonosMachine: params.IonosMachine,
}, nil
}

// HasFailed checks if the IonosCloudMachine is in a failed state.
func (m *MachineScope) HasFailed() bool {
status := m.IonosCloudMachine.Status
status := m.IonosMachine.Status
return status.FailureReason != nil || status.FailureMessage != nil
}

// PatchObject will apply all changes from the IonosCloudMachine.
// It will also make sure to patch the status subresource.
func (m *MachineScope) PatchObject() error {
conditions.SetSummary(m.IonosCloudMachine,
conditions.SetSummary(m.IonosMachine,
conditions.WithConditions(
infrav1.MachineProvisionedCondition))

Expand All @@ -115,7 +115,7 @@ func (m *MachineScope) PatchObject() error {
// would cause the patch to be aborted as well.
return m.patchHelper.Patch(
timeoutCtx,
m.IonosCloudMachine,
m.IonosMachine,
patch.WithOwnedConditions{Conditions: []clusterv1.ConditionType{
clusterv1.ReadyCondition,
infrav1.MachineProvisionedCondition,
Expand Down

0 comments on commit ae0ee97

Please sign in to comment.