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: prevent updates to mcs.types or when multiple types are involved. #4454

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

jwcesign
Copy link
Member

@jwcesign jwcesign commented Dec 19, 2023

What type of PR is this?
/kind feature

What this PR does / why we need it:
Currently, the north-south traffic routing is implemented through ServiceImport/ServiceExport by collecting EndpointSlice from member clusters to Karmada control plane for Work resources.

The east-west MCS will also collect EndpointSlice for Work, and both sides will jointly manage the overlay of Work operations.

If both types are configured at the same time, when the north-south Work is overlaid (mcs label is deleted), the east-west MCS cannot synchronize the provider cluster's endpointslice to consumer clusters.

This PR temporarily prohibits mixed configuration and will resolve related conflict issues in future updates.

Which issue(s) this PR fixes:
Part of #4292

Special notes for your reviewer:
none

Does this PR introduce a user-facing change?:

`karmada-webhook`: prevent updates to mcs.types or when multiple types are involved.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 19, 2023
@karmada-bot karmada-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 19, 2023
@jwcesign
Copy link
Member Author

/cc @XiShanYongYe-Chang

@jwcesign jwcesign force-pushed the forbid-mcs-update branch 2 times, most recently from 283dfc3 to 4f52253 Compare December 19, 2023 12:18
@karmada-bot karmada-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 19, 2023
@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2023

Codecov Report

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

Comparison is base (33c98a4) 51.86% compared to head (dc43383) 51.86%.

Files Patch % Lines
pkg/webhook/multiclusterservice/validating.go 38.46% 8 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4454      +/-   ##
==========================================
- Coverage   51.86%   51.86%   -0.01%     
==========================================
  Files         243      243              
  Lines       24167    24180      +13     
==========================================
+ Hits        12535    12540       +5     
- Misses      10950    10958       +8     
  Partials      682      682              
Flag Coverage Δ
unittests 51.86% <38.46%> (-0.01%) ⬇️

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 forbid-mcs-update branch 2 times, most recently from 532940d to dc43383 Compare December 19, 2023 13:24
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.

/assign

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.

I understand this is a temporary protection measure to avoid conflicts between CrossCluster(MCS) and Loadbalancer(MCI). However, this conflict issue should be resolved in the release-1.9 cycle.

cc @GitHubxsy @chaunceyjiang Please look at this, need your comments here.

Comment on lines +120 to +122
if len(typesSet) > 1 {
allErrs = append(allErrs, field.Invalid(typesPath, mcs.Spec.Types, "MultiClusterService types should not contain more than one type"))
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we don't need to introduce another set, how about this:

Suggested change
if len(typesSet) > 1 {
allErrs = append(allErrs, field.Invalid(typesPath, mcs.Spec.Types, "MultiClusterService types should not contain more than one type"))
}
// temporarily disable two expose types
if len(mcs.Spec.Types) > 1 {
allErrs = append(allErrs, field.Invalid(typesPath, mcs.Spec.Types, "MultiClusterService types should not contain more than one type"))
}

Copy link
Member Author

Choose a reason for hiding this comment

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

mcs.Spec.Types can be configured as {LoadBalancer, LoadBalancer}. In this situation, it's the same type.

Copy link
Member Author

Choose a reason for hiding this comment

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

BTW, we should deduplicate, but in another PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

We need to consider whether to prohibit users from filling in the same type of element. My idea is that it should be prohibited.

@GitHubxsy
Copy link
Contributor

lgtm

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 20, 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 20, 2023
@karmada-bot karmada-bot merged commit 41acf8f into karmada-io:master Dec 20, 2023
12 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/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants