Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Oct 17, 2024
1 parent 42e7ad1 commit e863569
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
6 changes: 0 additions & 6 deletions api/v1beta1/v1beta2_condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
32 changes: 16 additions & 16 deletions internal/controllers/machineset/machineset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e863569

Please sign in to comment.