Skip to content
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

feat: fix resource(work/resource in member clusters) conflicting between PP and MCS. #4414

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

jwcesign
Copy link
Member

@jwcesign jwcesign commented Dec 13, 2023

What type of PR is this?
/kind api-change
/kind feature

What this PR does / why we need it:
Previously, we directly generated service work, but this led to conflicts with work created based on RB/PP. To resolve this issue, we introduced a new naming style for the work.

To prevent these conflicts, we propose a solution: MCS will generate RB from the service and if there's an existing RB generated by PP, MCS will assume control over it. This way, no conflict arises. Additionally, once a resource is matched by MCS, the detector should ignore it.

Looking ahead, other CRs similar to MCS(like a scenario-related PP) may emerge in future scenarios. They should adhere to this approach to avoid potential conflicts.

Which issue(s) this PR fixes:
Fixes #none

Special notes for your reviewer:
none

Does this PR introduce a user-facing change?:

`karmada-controller-manager`: Fix resource(work/resource in member clusters) conflicting between PP and MCS.

@karmada-bot karmada-bot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. labels Dec 13, 2023
@karmada-bot karmada-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Dec 13, 2023
@karmada-bot karmada-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 13, 2023
@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2023

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (5c1ba0f) 51.92% compared to head (cefd90e) 51.89%.

Files Patch % Lines
pkg/util/helper/mcs.go 0.00% 18 Missing ⚠️
pkg/detector/detector.go 0.00% 7 Missing ⚠️
pkg/scheduler/event_handler.go 0.00% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4414      +/-   ##
==========================================
- Coverage   51.92%   51.89%   -0.03%     
==========================================
  Files         243      243              
  Lines       24150    24162      +12     
==========================================
- Hits        12539    12538       -1     
- Misses      10930    10943      +13     
  Partials      681      681              
Flag Coverage Δ
unittests 51.89% <18.18%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jwcesign jwcesign force-pushed the fix-pp-conflict branch 4 times, most recently from cf63989 to 63c22d2 Compare December 14, 2023 07:20
@jwcesign jwcesign force-pushed the fix-pp-conflict branch 2 times, most recently from 84d87d8 to ea011b1 Compare December 14, 2023 09:03
pkg/util/constants.go Outdated Show resolved Hide resolved
pkg/detector/detector.go Outdated Show resolved Hide resolved
pkg/detector/detector.go Outdated Show resolved Hide resolved
pkg/events/events.go Outdated Show resolved Hide resolved
Comment on lines +143 to +144
// EventReasonConfigurationRedundant indicates that MultiClusterService configuration redundant.
EventReasonConfigurationRedundant = "ConfigurationRedundant"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider another name.

pkg/apis/work/v1alpha2/well_known_constants.go Outdated Show resolved Hide resolved
@@ -108,7 +108,8 @@ func (s *Scheduler) resourceBindingEventFilter(obj interface{}) bool {
}

return util.GetLabelValue(accessor.GetLabels(), policyv1alpha1.PropagationPolicyNameLabel) != "" ||
util.GetLabelValue(accessor.GetLabels(), policyv1alpha1.ClusterPropagationPolicyLabel) != ""
util.GetLabelValue(accessor.GetLabels(), policyv1alpha1.ClusterPropagationPolicyLabel) != "" ||
util.GetLabelValue(accessor.GetLabels(), workv1alpha2.BindingManagedByLabel) != ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: consider a new label name.

@jwcesign jwcesign force-pushed the fix-pp-conflict branch 2 times, most recently from 6f3632f to cefd90e Compare December 14, 2023 11:19
Signed-off-by: jwcesign <jwcesign@gmail.com>
pkg/util/constants.go Outdated Show resolved Hide resolved
@jwcesign jwcesign changed the title feat: fix conflicts with pp feat: fix resource(work/resoruce in member clusters) conflicting between PP and MCS. Dec 14, 2023
@jwcesign jwcesign changed the title feat: fix resource(work/resoruce in member clusters) conflicting between PP and MCS. feat: fix resource(work/resource in member clusters) conflicting between PP and MCS. Dec 14, 2023
pkg/util/helper/mcs.go Outdated Show resolved Hide resolved
pkg/util/helper/mcs.go Outdated Show resolved Hide resolved
test/e2e/mcs_test.go Show resolved Hide resolved
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2023
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 14, 2023
@karmada-bot karmada-bot merged commit 99447b0 into karmada-io:master Dec 14, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants