Skip to content

Commit

Permalink
Merge pull request #3851 from chaunceyjiang/automated-cherry-pick-of-…
Browse files Browse the repository at this point in the history
…#3848-origin-release-1.6

Automated cherry pick of #3848: fix: When the PP is deleted, the
  • Loading branch information
karmada-bot authored Jul 28, 2023
2 parents 8e04d55 + e4d3233 commit bf2358d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/detector/policy.go
Original file line number Diff line number Diff line change
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 bf2358d

Please sign in to comment.