diff --git a/internal/controller/conditionsutil/conditions_util.go b/internal/controller/conditionsutil/conditions_util.go index 128b0ddac..7729c604b 100644 --- a/internal/controller/conditionsutil/conditions_util.go +++ b/internal/controller/conditionsutil/conditions_util.go @@ -67,11 +67,12 @@ func mergeCondition(existingConditionsToUpdate *[]metav1.Condition, newCondition // If there is no existing condition of this type, append this one and we're done. *existingConditionsToUpdate = append(*existingConditionsToUpdate, *newCondition) return true - } else { - existingCondition = &(*existingConditionsToUpdate)[index] } - // Set the LastTransitionTime depending on whether the status has changed. + // Get a pointer to the existing condition + existingCondition = &(*existingConditionsToUpdate)[index] + + // If the status has not changed, preserve the original lastTransitionTime if newCondition.Status == existingCondition.Status { newCondition.LastTransitionTime = existingCondition.LastTransitionTime }