Skip to content

Commit ea916c6

Browse files
committed
refactor, update tests and UX for crp status
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
1 parent f0c4ad4 commit ea916c6

File tree

6 files changed

+704
-50
lines changed

6 files changed

+704
-50
lines changed

pkg/controllers/clusterresourceplacement/placement_status.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,18 @@ func setCRPConditions(
232232
shouldSkipRestCondTypes = true
233233
case rpsSetCondTypeCounter[i][condition.FalseConditionStatus] > 0:
234234
// There is at least one False condition of the given type being set on the per cluster placement statuses.
235-
crp.SetConditions(i.FalseClusterResourcePlacementCondition(crp.Generation, rpsSetCondTypeCounter[i][condition.FalseConditionStatus]))
235+
if len(crp.Status.SelectedResources) == 0 && i == condition.AppliedCondition {
236+
// If the CRP has not selected any resources
237+
crp.SetConditions(metav1.Condition{
238+
Status: metav1.ConditionFalse,
239+
Type: string(fleetv1beta1.ClusterResourcePlacementAppliedConditionType),
240+
Reason: ApplyFailedReason,
241+
Message: fmt.Sprintf("Failed to apply resources to %d cluster(s). Please check placement status.", rpsSetCondTypeCounter[i][condition.FalseConditionStatus]),
242+
ObservedGeneration: crp.Generation,
243+
})
244+
} else {
245+
crp.SetConditions(i.FalseClusterResourcePlacementCondition(crp.Generation, rpsSetCondTypeCounter[i][condition.FalseConditionStatus]))
246+
}
236247
shouldSkipRestCondTypes = true
237248
default:
238249
// All the conditions of the given type are True.

0 commit comments

Comments
 (0)