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
custom enable or disable of scheduler plugins #2135
custom enable or disable of scheduler plugins #2135
Conversation
Thanks~ /assign |
Hi,how's the progress? @XiShanYongYe-Chang |
Sorry. I'm going to start reviewing now. |
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.
Good job!
/cc @Poor12
} | ||
|
||
// Filter out the disabled plugin | ||
func (r Registry) Filter(names []string) Registry { |
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.
Can we add a ut for this method?
I have a question: if the plugins is -foo,*
, dose the result contain foo
?
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.
Can we add a ut for this method?
ok.
dose the result contain foo?
no, the result is *
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.
If so, the behavior of --plugins
will be different from controllers. I think that the writing habits should be consistent:
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.
ok
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.
We have a similar logic at --controllers
in karmada-controller-manager
, which is used another way:
karmada/pkg/controllers/context/context.go
Lines 76 to 96 in 821a185
func (c Context) IsControllerEnabled(name string, disabledByDefaultControllers sets.String) bool { | |
hasStar := false | |
for _, ctrl := range c.Opts.Controllers { | |
if ctrl == name { | |
return true | |
} | |
if ctrl == "-"+name { | |
return false | |
} | |
if ctrl == "*" { | |
hasStar = true | |
} | |
} | |
// if we get here, there was no explicit choice | |
if !hasStar { | |
// nothing on by default | |
return false | |
} | |
return !disabledByDefaultControllers.Has(name) | |
} |
I'm not sure if we can share some code here, will look at it later.
520f2af
to
87a42a1
Compare
e2a8c19
to
a3eeda3
Compare
/lgtm |
/lgtm |
@XiShanYongYe-Chang: GitHub didn't allow me to request PR reviews from the following users: likakuli. Note that only karmada-io members and repo collaborators can review this PR, and authors cannot review their own PRs. 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. |
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.
Generally looks good to me.
Some guys also requested this feature a long time ago but have been postponed as no clear use case at that time.
cc @likakuli
Who might need it?
@chaunceyjiang Can you explain why you need it in your case, and which plugin you want to disable?
By the way, given the plugin name will be exposed to users, I'd like to request a final review of the plugin names. karmada/pkg/scheduler/framework/plugins/registry.go Lines 15 to 19 in 821a185
Any idea would be welcome! |
a3eeda3
to
59023d0
Compare
I am thinking that we can provide a karmada-scheduler with only basic plugins, and users can build their own scheduler based on this karmada-scheduler according to their own needs. We allow karmada to have multiple schedulers. When distributing workloads, a field is used to declare which scheduler to use, such as what do you think @RainbowMango @Garrybest @kerthcet |
I remember that(#1854 ), it still on my TODO list :) |
Given not all users need to extend the scheduler on their own, I prefer to enhance scalability(like this PR) and make it easy for users to choose. |
Where the field |
But the scheduler now does not use it yet. I guess @prodanlabs did it by himself. |
Cool, I like this feature. |
From a high level perspective, managing configurations via flags poses certain problems like they are unversioned, the maintenance burden grows as the number of flags grows, flags exist in a flat namespace which is hard to organize structuring configurations. Considering we have quite a number of configations in karmada scheduler, and we like to have more in the future, I think we should migrate to Conponent Config gradually. Scheduler plugins can also be part of this. I think this is where we want to forward, but now, back to the reality, we have rarely plugins in karmada, what we settled in this PR can be a transition plan, since many users are eager for this IIRC. Regarding to @prodanlabs proposal, different scheduler for different scenario makes sense to me, and we also have a entrance already. If we're planning to move forward, I think Component Config would be a better choice. |
Regarding the issue of multiple schedulers, we can open another issues discussion. |
So, for this PR, is there anything else I need to update? |
I have several questions:
|
@chaunceyjiang Just opened #2170 for the naming thing.
I'll get back to this PR after #2170. I'll look at if we have another way to implement it just like I mentioned at #2135 (comment). |
/assign |
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.
Generally looks good to me.
--plugins strings
A list of plugins to enable. '*' enables all on-by-default plugins, 'foo' enables the plugin named 'foo', '*,-foo' disables the plugin named 'foo'.
All build-in plugins: APIEnablement,ClusterAffinity,ClusterLocality,SpreadConstraint,TaintToleration. (default [*])
Just a question, since this flag also applies to customized plugins, should we mention it in usage?
'*' enables all on-by-default plugins
-->
'*' enables all build-in and customized plugins
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
59023d0
to
fc600ae
Compare
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.
/lgtm
/approve
Thanks for your quick response.
[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 |
There are resource constraints on GitHub actions in each repo. Now there are too many E2E kind clusters, and contributors are relatively active during the day. The probability of E2E error is too high. It is suggested to reduce the number of E2E kind clusters. Can we cancel the E2E test (v1.21.10) |
Really? Where did you see that?
I know @XiShanYongYe-Chang and @mrlihanbo are trying to figure out the reason, but don't really have a clue yet. |
Yeah, I know the resource limit, but we haven't reached the limit, right? The e2e tests(v1.21,v1.22,v1.23,v1.24) are run in different virtual machines, they don't affect each other in theory. |
Hi @chaunceyjiang, our CI is far from reaching the limit of github action. Currently, the failed CIs are mainly in the v1.24 k8s cluster, the cause of the failure is that We have not figured out the root cause of the CI failure of v1.24. k8s cluster. Can you help figure it out together? |
Signed-off-by: chaunceyjiang chaunceyjiang@gmail.com
What type of PR is this?
/kind feature
What this PR does / why we need it:
custom enable or disable of scheduler plugins
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: