From f84a0e57930def5c9c1c522056027b057f006388 Mon Sep 17 00:00:00 2001 From: whitewindmills Date: Thu, 7 Dec 2023 13:45:31 +0800 Subject: [PATCH] ensure resource template be un-claimed when deleting cluster policy Signed-off-by: whitewindmills --- pkg/detector/detector.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/detector/detector.go b/pkg/detector/detector.go index 99bef8db9753..17b1bdf708ad 100644 --- a/pkg/detector/detector.go +++ b/pkg/detector/detector.go @@ -1177,6 +1177,8 @@ func (d *ResourceDetector) HandleClusterPropagationPolicyDeletion(policyName str klog.Errorf("Failed to clean up label from resource(%s-%s) when cluster propagation policy(%s) removing, error: %v", binding.Spec.Resource.Kind, binding.Spec.Resource.Name, policyName, err) errs = append(errs, err) + // Skip cleaning up policy labels from ClusterResourceBinding, give a chance to do that in a retry loop. + continue } // Clean up the labels from the reference binding so that the karmada scheduler won't reschedule the binding. @@ -1202,6 +1204,8 @@ func (d *ResourceDetector) HandleClusterPropagationPolicyDeletion(policyName str klog.Errorf("Failed to clean up label from resource(%s-%s/%s) when cluster propagation policy(%s) removing, error: %v", binding.Spec.Resource.Kind, binding.Spec.Resource.Namespace, binding.Spec.Resource.Name, policyName, err) errs = append(errs, err) + // Skip cleaning up policy labels from ResourceBinding, give a chance to do that in a retry loop. + continue } // Clean up the labels from the reference binding so that the karmada scheduler won't reschedule the binding.