From e8635693fed11a2d5892d67122ec23b459f85217 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Thu, 17 Oct 2024 15:54:11 +0200 Subject: [PATCH] fix --- api/v1beta1/v1beta2_condition_consts.go | 6 ---- .../machineset/machineset_controller.go | 32 +++++++++---------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/api/v1beta1/v1beta2_condition_consts.go b/api/v1beta1/v1beta2_condition_consts.go index 213e3ce7d38b..8a2cacc44657 100644 --- a/api/v1beta1/v1beta2_condition_consts.go +++ b/api/v1beta1/v1beta2_condition_consts.go @@ -83,12 +83,6 @@ const ( // Please use object specific variants of this condition which provides more details for each context where // the same condition type exists. PausedV1Beta2Condition = "Paused" - - // ResourceNotPausedV1Beta2Reason surfaces when a resource has been paused. - ResourceNotPausedV1Beta2Reason = "ResourceNotPaused" - - // ResourcePausedV1Beta2Reason surfaces when a resource is not paused. - ResourcePausedV1Beta2Reason = "ResourcePaused" ) // Reasons that are used across different objects. diff --git a/internal/controllers/machineset/machineset_controller.go b/internal/controllers/machineset/machineset_controller.go index 29477b019dc7..ecda137e106b 100644 --- a/internal/controllers/machineset/machineset_controller.go +++ b/internal/controllers/machineset/machineset_controller.go @@ -309,6 +309,22 @@ func patchMachineSet(ctx context.Context, patchHelper *patch.Helper, machineSet return patchHelper.Patch(ctx, machineSet, options...) } +func (r *Reconciler) getOwningMachineDeployment(ctx context.Context, s *scope) (ctrl.Result, error) { + if !isDeploymentChild(s.machineSet) { + // If the MachineSet is not in a MachineDeployment, return immediately. + return ctrl.Result{}, nil + } + + // Otherwise get the owning MachineDeployment + var err error + s.owningMachineDeployment, err = r.getOwnerMachineDeployment(ctx, s.machineSet) + if err != nil { + return ctrl.Result{}, err + } + + return ctrl.Result{}, nil +} + func (r *Reconciler) reconcileMachineSetOwnerAndLabels(_ context.Context, s *scope) (ctrl.Result, error) { // Reconcile and retrieve the Cluster object. if s.machineSet.Labels == nil { @@ -342,22 +358,6 @@ func (r *Reconciler) reconcileMachineSetOwnerAndLabels(_ context.Context, s *sco return ctrl.Result{}, nil } -func (r *Reconciler) getOwningMachineDeployment(ctx context.Context, s *scope) (ctrl.Result, error) { - if !isDeploymentChild(s.machineSet) { - // If the MachineSet is not in a MachineDeployment, return immediately. - return ctrl.Result{}, nil - } - - // Otherwise get the owning MachineDeployment - var err error - s.owningMachineDeployment, err = r.getOwnerMachineDeployment(ctx, s.machineSet) - if err != nil { - return ctrl.Result{}, err - } - - return ctrl.Result{}, nil -} - func (r *Reconciler) reconcileInfrastructure(ctx context.Context, s *scope) (ctrl.Result, error) { // Make sure to reconcile the external infrastructure reference. var err error