Skip to content

Commit 3664bbb

Browse files
committed
fix conditions outcome for when override deletes resource
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
1 parent 29d0900 commit 3664bbb

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pkg/controllers/workgenerator/controller.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,11 +1049,23 @@ func setAllWorkAppliedCondition(works map[string]*fleetv1beta1.Work, binding *fl
10491049
case len(works) == 0:
10501050
// No Work objects are associated with the binding.
10511051
klog.V(2).InfoS("No works are associated with the binding", "binding", klog.KObj(binding))
1052+
cond := binding.GetCondition(string(fleetv1beta1.ResourceBindingOverridden))
1053+
if cond != nil && cond.Reason == condition.OverriddenSucceededReason {
1054+
// The resources were deleted by override operation
1055+
binding.SetConditions(metav1.Condition{
1056+
Status: metav1.ConditionTrue,
1057+
Type: string(fleetv1beta1.ResourceBindingApplied),
1058+
Reason: condition.AllWorkAppliedReason,
1059+
Message: "All corresponding work objects are applied",
1060+
ObservedGeneration: binding.GetGeneration(),
1061+
})
1062+
return workConditionSummarizedStatusTrue
1063+
}
10521064
binding.SetConditions(metav1.Condition{
10531065
Status: metav1.ConditionFalse,
10541066
Type: string(fleetv1beta1.ResourceBindingApplied),
10551067
Reason: condition.WorkNotAppliedReason,
1056-
Message: "No work objects are associated with the binding because no resources were selected. Update CRP spec to select resources.",
1068+
Message: "No resources were selected. Update CRP spec to select existing resources or create resources on hub cluster",
10571069
ObservedGeneration: binding.GetGeneration(),
10581070
})
10591071
return workConditionSummarizedStatusFalse

0 commit comments

Comments
 (0)