Avoid unnecessary comparasion
@@ -155,8 +155,7 @@ func (r *ReconcilePerconaXtraDBCluster) updateStatus(cr *api.PerconaXtraDBCluste
LastTransitionTime: metav1.NewTime(time.Now()),
}
cr.Status.Conditions = append(cr.Status.Conditions, clusterCondition)
- }
-
+ } else {
lastClusterCondition := cr.Status.Conditions[len(cr.Status.Conditions)-1]
switch {
@@ -165,6 +164,7 @@ func (r *ReconcilePerconaXtraDBCluster) updateStatus(cr *api.PerconaXtraDBCluste
default:
cr.Status.Conditions[len(cr.Status.Conditions)-1] = lastClusterCondition
}
+ }
if len(cr.Status.Conditions) > maxStatusesQuantity {
cr.Status.Conditions = cr.Status.Conditions[len(cr.Status.Conditions)-maxStatusesQuantity:]
