diff --git a/controllers/core/openstackversion_controller.go b/controllers/core/openstackversion_controller.go index 2c0ff6515..5f508637f 100644 --- a/controllers/core/openstackversion_controller.go +++ b/controllers/core/openstackversion_controller.go @@ -110,6 +110,10 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req 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, @@ -124,6 +128,8 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req // Always patch the instance status when exiting this function so we can persist any changes. defer func() { + condition.RestoreLastTransitionTimes( + &instance.Status.Conditions, savedConditions) // update the Ready condition based on the sub conditions if instance.Status.Conditions.AllSubConditionIsTrue() { instance.Status.Conditions.MarkTrue(