-
Notifications
You must be signed in to change notification settings - Fork 883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implementation of Policy LazyReconcile feature #4570
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
func (d *ResourceDetector) addRelatedTemplateToProcessorQueue(policy *policyv1alpha1.ClusterPropagationPolicy) error { | ||
resourceBindings, err := d.listCPPDerivedRB(policy.Name) | ||
if err != nil { | ||
return fmt.Errorf("failed to list CPP(%s) derived RB: %+v", policy.Name, err) | ||
} | ||
clusterResourceBindings, err := d.listCPPDerivedCRB(policy.Name) | ||
if err != nil { | ||
return fmt.Errorf("failed to list CPP(%s) derived CRB: %+v", policy.Name, err) | ||
} | ||
for _, rb := range resourceBindings.Items { | ||
resourceKey, err := helper.ConstructClusterWideKey(rb.Spec.Resource) | ||
if err != nil { | ||
return fmt.Errorf("failed to get resource ClusterWideKey from RB(%s): %+v", rb.Name, err) | ||
} | ||
d.Processor.Add(resourceKey) | ||
} | ||
for _, crb := range clusterResourceBindings.Items { | ||
resourceKey, err := helper.ConstructClusterWideKey(crb.Spec.Resource) | ||
if err != nil { | ||
return fmt.Errorf("failed to get resource ClusterWideKey from CRB(%s): %+v", crb.Name, err) | ||
} | ||
d.Processor.Add(resourceKey) | ||
} | ||
return nil | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation: the reason for extracting this function is that the complexity of the code in the original function exceeded limits, causing ci-lint to crash.
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #4570 +/- ##
==========================================
- Coverage 51.89% 51.81% -0.09%
==========================================
Files 246 246
Lines 24328 24370 +42
==========================================
+ Hits 12626 12628 +2
- Misses 11016 11055 +39
- Partials 686 687 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: chaosi-zju <chaosi@zju.edu.cn>
} | ||
|
||
// check whether there are matched RT in waiting list, is so, add it to processor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// check whether there are matched RT in waiting list, is so, add it to processor | |
// check whether there are matched RT in waiting list, if so, add it to processor |
// If Policy LazyReconcile feature enabled, ignore the label/annotation modifications by karmada's own components. | ||
if features.FeatureGate.Enabled(features.PolicyLazyReconcile) { | ||
// Remove the labels or annotations modified by karmada's own components. | ||
for k := range oldBackup.GetLabels() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a reference, can we extract the deletion of labels and annotations controlled by Karmada into a independent function? This will ensure consistency in the operations of newBackup
and oldBackup
.
/close this implementation is deprecated, replaced by #4577. |
@chaosi-zju: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Implementation of Policy LazyReconcile feature.
When this feature is enabled, the resource will not immediately respond to policy modifications if it has already been distributed according to the previous policy. Instead, it will only respond to the policy changes during the next update of the resource.
More info refer to #4563
Which issue(s) this PR fixes:
Fixes part of #4563
Special notes for your reviewer:
This PR depends on the #4564, it is recommended to wait until the #4564 is merged and then rebase this PR before reviewing it.
Does this PR introduce a user-facing change?: