Skip to content

Commit ea25b76

Browse files
Merge pull request #775 from gibizer/helper-inhit
Version: Create helper before manipulating instance
2 parents b4b4aad + 670e517 commit ea25b76

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

‎controllers/core/openstackversion_controller.go‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,6 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req
105105
return ctrl.Result{}, err
106106
}
107107

108-
isNewInstance := instance.Status.Conditions == nil
109-
if isNewInstance {
110-
instance.Status.Conditions = condition.Conditions{}
111-
}
112-
113-
// Save a copy of the condtions so that we can restore the LastTransitionTime
114-
// when a condition's state doesn't change.
115-
savedConditions := instance.Status.Conditions.DeepCopy()
116-
117108
versionHelper, err := helper.NewHelper(
118109
instance,
119110
r.Client,
@@ -126,6 +117,15 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req
126117
return ctrl.Result{}, err
127118
}
128119

120+
isNewInstance := instance.Status.Conditions == nil
121+
if isNewInstance {
122+
instance.Status.Conditions = condition.Conditions{}
123+
}
124+
125+
// Save a copy of the condtions so that we can restore the LastTransitionTime
126+
// when a condition's state doesn't change.
127+
savedConditions := instance.Status.Conditions.DeepCopy()
128+
129129
// Always patch the instance status when exiting this function so we can persist any changes.
130130
defer func() {
131131
// update the Ready condition based on the sub conditions

0 commit comments

Comments
 (0)