From 4540d2ffa88b2b42a1f2edf0f802af1e6b681f1e Mon Sep 17 00:00:00 2001 From: michaelawyu Date: Sun, 19 Jan 2025 02:33:43 +0800 Subject: [PATCH] Minor fixes --- .../clusterresourceplacement/placement_status.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/controllers/clusterresourceplacement/placement_status.go b/pkg/controllers/clusterresourceplacement/placement_status.go index 6a7a605a2..1a864869f 100644 --- a/pkg/controllers/clusterresourceplacement/placement_status.go +++ b/pkg/controllers/clusterresourceplacement/placement_status.go @@ -146,6 +146,12 @@ func (r *Reconciler) setScheduledResourcePlacementStatuses( clusterDecision := selected[idx] rps := &fleetv1beta1.ResourcePlacementStatus{} + // Port back the old conditions. + // This is necessary for Fleet to track the last transition times correctly. + if oldConds, ok := oldRPSMap[clusterDecision.ClusterName]; ok { + rps.Conditions = oldConds + } + // Set the scheduled condition. scheduledCondition := metav1.Condition{ Status: metav1.ConditionTrue, @@ -159,12 +165,6 @@ func (r *Reconciler) setScheduledResourcePlacementStatuses( // Set the cluster name. rps.ClusterName = clusterDecision.ClusterName - // Port back the old conditions. - // This is necessary for Fleet to track the last transition times correctly. - if oldConds, ok := oldRPSMap[clusterDecision.ClusterName]; ok { - rps.Conditions = oldConds - } - // Prepare the new conditions. binding := bindingMap[clusterDecision.ClusterName] setStatusByCondType, err := r.setResourcePlacementStatusPerCluster(crp, latestClusterResourceSnapshot, binding, rps, expectedCondTypes)