Skip to content

Commit

Permalink
Merge pull request #3848 from chaunceyjiang/delete_pp
Browse files Browse the repository at this point in the history
fix: when the PP is deleted, the propagationpolicy.karmada.io/name label in the resource template's labels is not removed.
  • Loading branch information
karmada-bot committed Jul 28, 2023
2 parents f160ea7 + 3274d64 commit 2526de8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/detector/policy.go
Expand Up @@ -89,6 +89,10 @@ func (d *ResourceDetector) propagateResource(object *unstructured.Unstructured,
func (d *ResourceDetector) getAndApplyPolicy(object *unstructured.Unstructured, objectKey keys.ClusterWideKey, policyNamespace, policyName string) error {
policyObject, err := d.propagationPolicyLister.ByNamespace(policyNamespace).Get(policyName)
if err != nil {
if apierrors.IsNotFound(err) {
klog.V(4).Infof("PropagationPolicy(%s/%s) has been removed.", policyNamespace, policyName)
return d.HandlePropagationPolicyDeletion(policyNamespace, policyName)
}
klog.Errorf("Failed to get claimed policy(%s/%s),: %v", policyNamespace, policyName, err)
return err
}
Expand Down Expand Up @@ -122,6 +126,11 @@ func (d *ResourceDetector) getAndApplyPolicy(object *unstructured.Unstructured,
func (d *ResourceDetector) getAndApplyClusterPolicy(object *unstructured.Unstructured, objectKey keys.ClusterWideKey, policyName string) error {
policyObject, err := d.clusterPropagationPolicyLister.Get(policyName)
if err != nil {
if apierrors.IsNotFound(err) {
klog.V(4).Infof("ClusterPropagationPolicy(%s) has been removed.", policyName)
return d.HandleClusterPropagationPolicyDeletion(policyName)
}

klog.Errorf("Failed to get claimed policy(%s),: %v", policyName, err)
return err
}
Expand Down

0 comments on commit 2526de8

Please sign in to comment.