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: Allows setting wildcards for SkippedPropagatingNamespaces #3373

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

chaunceyjiang
Copy link
Member

@chaunceyjiang chaunceyjiang commented Apr 7, 2023

What type of PR is this?
/kind feature

What this PR does / why we need it:

Allows user settings to skip namespace propagation with specific prefixes/suffixes.

Like: openshift-xxxxxx

image

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmada-controller-manager`: Allows setting wildcards for `--skippedPropagatingNamespaces` flag.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 7, 2023
@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 7, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #3373 (8b701db) into master (cbf5c4a) will decrease coverage by 0.10%.
The diff coverage is 0.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #3373      +/-   ##
==========================================
- Coverage   51.69%   51.59%   -0.10%     
==========================================
  Files         210      210              
  Lines       18931    18927       -4     
==========================================
- Hits         9786     9766      -20     
- Misses       8619     8633      +14     
- Partials      526      528       +2     
Flag Coverage Δ
unittests 51.59% <0.00%> (-0.10%) ⬇️

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

Impacted Files Coverage Δ
cmd/controller-manager/app/options/validation.go 87.09% <0.00%> (-12.91%) ⬇️
pkg/detector/detector.go 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@XiShanYongYe-Chang
Copy link
Member

Hi @chaunceyjiang, can you give some examples of how to use this parameter?

@chaunceyjiang
Copy link
Member Author

Hi @chaunceyjiang, can you give some examples of how to use this parameter?

Example:

 --skipped-propagating-namespaces=openshift-.*,example-namespace,.*-ns-suffixes

Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

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

Thanks~

cmd/controller-manager/app/options/validation.go Outdated Show resolved Hide resolved
Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

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

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 7, 2023
@chaunceyjiang
Copy link
Member Author

Hi @RainbowMango Can you help to re-trigger e2e?

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

@karmada-bot karmada-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 11, 2023
@chaunceyjiang chaunceyjiang force-pushed the wildcards branch 3 times, most recently from e56cccf to 3572e3f Compare April 11, 2023 15:17
@chaunceyjiang
Copy link
Member Author

chaunceyjiang commented Apr 11, 2023

image

BenchmarkEventFilterNoSkipNameSpaces-8 is the benchmark of the original function.

Each operation takes about 522.4ns , which I think is acceptable. What do you think? @RainbowMango

@RainbowMango
Copy link
Member

I tested the BenchmarkEventFilterNoMatchSkipNameSpaces on my side and compared the performance changes before and after the patch(by benchstat), seems that this patch got 4.4% slower than before:

# benchstat BenchmarkEventFilterNoMatchSkipNameSpaces.before BenchmarkEventFilterNoMatchSkipNameSpaces.after 
goos: linux
goarch: amd64
pkg: github.com/karmada-io/karmada/pkg/detector
cpu: Intel(R) Xeon(R) Gold 6278C CPU @ 2.60GHz
                                   │ BenchmarkEventFilterNoMatchSkipNameSpaces.before │ BenchmarkEventFilterNoMatchSkipNameSpaces.after │
                                   │                      sec/op                      │          sec/op           vs base               │
EventFilterNoMatchSkipNameSpaces-4                                        1.199µ ± 1%                1.252µ ± 1%  +4.42% (p=0.000 n=15)

This seems acceptable, I'm surprised by the result though. I guess the reason might be we pre-compile the regular expression when parsing raw options at here.

@chaunceyjiang
Copy link
Member Author

The compilation does have a large impact on the speed:

golang/go#26623 (comment)

@RainbowMango
Copy link
Member

Yes, thanks, I will look at the ASAP.

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.

Generally looks good to me, with some nits.

cmd/controller-manager/app/controllermanager.go Outdated Show resolved Hide resolved
cmd/controller-manager/app/options/validation.go Outdated Show resolved Hide resolved
pkg/controllers/context/context.go Show resolved Hide resolved
@chaunceyjiang chaunceyjiang force-pushed the wildcards branch 4 times, most recently from 5bb5ae2 to 3489838 Compare April 19, 2023 04:34
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
@chaunceyjiang
Copy link
Member Author

Done.

/cc @RainbowMango

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
Thanks for your quick response 👍

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 19, 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 Apr 19, 2023
@karmada-bot karmada-bot merged commit 507e66f into karmada-io:master Apr 19, 2023
11 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants