Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func updateClusterResourceBindingWithAvailable(binding *placementv1beta1.Cluster
cond = metav1.Condition{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ResourceBindingAvailable),
Reason: condition.AvailableReason,
Reason: condition.NoResourcesSelectedReason,
ObservedGeneration: binding.Generation,
}
meta.SetStatusCondition(&binding.Status.Conditions, cond)
Expand Down Expand Up @@ -1338,7 +1338,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
wantCondition = metav1.Condition{
Status: metav1.ConditionTrue,
Type: string(placementv1beta1.ClusterResourcePlacementAvailableConditionType),
Reason: condition.AvailableReason,
Reason: condition.NoResourcesSelectedReason,
}
meta.SetStatusCondition(&wantCRP.Status.Conditions, wantCondition)
wantCondition.Type = string(placementv1beta1.ResourceBindingAvailable)
Expand Down
12 changes: 11 additions & 1 deletion pkg/controllers/clusterresourceplacement/placement_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ func setCRPConditions(
default:
// All the conditions of the given type are True.
cond := i.TrueClusterResourcePlacementCondition(crp.Generation, rpsSetCondTypeCounter[i][condition.TrueConditionStatus])
if i == condition.OverriddenCondition {
switch i {
case condition.OverriddenCondition:
hasOverride := false
for _, status := range allRPS {
if len(status.ApplicableResourceOverrides) > 0 || len(status.ApplicableClusterResourceOverrides) > 0 {
Expand All @@ -249,6 +250,15 @@ func setCRPConditions(
cond.Reason = condition.OverrideNotSpecifiedReason
cond.Message = "No override rules are configured for the selected resources"
}
case condition.AppliedCondition:
if len(crp.Status.SelectedResources) == 0 {
cond.Message = "Previous resources are deleted. No new resources are selected for the placement"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

``

Suggested change
cond.Message = "Previous resources are deleted. No new resources are selected for the placement"
cond.Message = "No new resources are selected for the placement and deleted applied resources if exists"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the reason to "NoResourcesSelectedReason" too?

}
case condition.AvailableCondition:
if len(crp.Status.SelectedResources) == 0 {
cond.Reason = condition.NoResourcesSelectedReason
cond.Message = "No new resources are selected for the placement. Please update crp to select new resources"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cond.Message = "No new resources are selected for the placement. Please update crp to select new resources"
cond.Message = "No new resources are applied for the placement"

cx can create the resources instead of updating crp.

}
}
crp.SetConditions(cond)
}
Expand Down
Loading
Loading