Skip to content

Commit

Permalink
Merge pull request #775 from gibizer/helper-inhit
Browse files Browse the repository at this point in the history
Version: Create helper before manipulating instance
  • Loading branch information
openshift-merge-bot[bot] authored Apr 25, 2024
2 parents b4b4aad + 670e517 commit ea25b76
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions controllers/core/openstackversion_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req
return ctrl.Result{}, err
}

isNewInstance := instance.Status.Conditions == nil
if isNewInstance {
instance.Status.Conditions = condition.Conditions{}
}

// Save a copy of the condtions so that we can restore the LastTransitionTime
// when a condition's state doesn't change.
savedConditions := instance.Status.Conditions.DeepCopy()

versionHelper, err := helper.NewHelper(
instance,
r.Client,
Expand All @@ -126,6 +117,15 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req
return ctrl.Result{}, err
}

isNewInstance := instance.Status.Conditions == nil
if isNewInstance {
instance.Status.Conditions = condition.Conditions{}
}

// Save a copy of the condtions so that we can restore the LastTransitionTime
// when a condition's state doesn't change.
savedConditions := instance.Status.Conditions.DeepCopy()

// Always patch the instance status when exiting this function so we can persist any changes.
defer func() {
// update the Ready condition based on the sub conditions
Expand Down

0 comments on commit ea25b76

Please sign in to comment.