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

custom enable or disable of scheduler plugins #2135

Merged
merged 1 commit into from Jul 20, 2022

Conversation

chaunceyjiang
Copy link
Member

@chaunceyjiang chaunceyjiang commented Jul 5, 2022

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?:

`karmada-scheduler`: Introduced `--plugins` flag to enable or disable scheduler plugins 

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 5, 2022
@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 5, 2022
@chaunceyjiang
Copy link
Member Author

  • Enable scheduler plugin
    image
    image

  • Disable scheduler plugin
    image
    image

@XiShanYongYe-Chang
Copy link
Member

Thanks~

/assign

@chaunceyjiang
Copy link
Member Author

chaunceyjiang commented Jul 7, 2022

Hi,how's the progress? @XiShanYongYe-Chang

@XiShanYongYe-Chang
Copy link
Member

Hi,how's the progress? @XiShanYongYe-Chang

Sorry. I'm going to start reviewing now.

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.

Good job!

/cc @Poor12

}

// Filter out the disabled plugin
func (r Registry) Filter(names []string) Registry {
Copy link
Member

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?

Copy link
Member Author

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 *

Copy link
Member

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:

https://github.com/karmada-io/karmada/blob/master/docs/userguide/configure-controllers.md#configure-karmada-controllers

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

Copy link
Member

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:

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.

pkg/scheduler/scheduler.go Show resolved Hide resolved
@karmada-bot karmada-bot requested a review from Poor12 July 7, 2022 03:15
@karmada-bot karmada-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 7, 2022
@chaunceyjiang chaunceyjiang force-pushed the scheduler_plugins branch 4 times, most recently from e2a8c19 to a3eeda3 Compare July 7, 2022 15:30
@chaunceyjiang
Copy link
Member Author

/cc @XiShanYongYe-Chang @Poor12

@Poor12
Copy link
Member

Poor12 commented Jul 8, 2022

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 8, 2022
@XiShanYongYe-Chang
Copy link
Member

/lgtm

/cc @RainbowMango @likakuli

@karmada-bot
Copy link
Collaborator

@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:

/lgtm

/cc @RainbowMango @likakuli

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.

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.

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?

cmd/scheduler/app/options/options.go Outdated Show resolved Hide resolved
pkg/scheduler/framework/runtime/registry.go Outdated Show resolved Hide resolved
pkg/scheduler/framework/runtime/registry.go Outdated Show resolved Hide resolved
@RainbowMango
Copy link
Member

By the way, given the plugin name will be exposed to users, I'd like to request a final review of the plugin names.

apiinstalled.Name: apiinstalled.New,
tainttoleration.Name: tainttoleration.New,
clusteraffinity.Name: clusteraffinity.New,
spreadconstraint.Name: spreadconstraint.New,
clusterlocality.Name: clusterlocality.New,

Any idea would be welcome!

@karmada-bot karmada-bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 8, 2022
@prodanlabs
Copy link
Member

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 schedulerName: demo-scheduler

what do you think @RainbowMango @Garrybest @kerthcet

@RainbowMango
Copy link
Member

RainbowMango commented Jul 9, 2022

yeah, this is one of what we need, another one is to use taint filter instead of directly filtering unready clusters, thx

I remember that(#1854 ), it still on my TODO list :)

@RainbowMango
Copy link
Member

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.

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.

@Garrybest
Copy link
Member

Where the field schedulerName exist? In PropagationPolicy?

@RainbowMango
Copy link
Member

Where the field schedulerName exist? In PropagationPolicy?

SchedulerName string `json:"schedulerName,omitempty"`

But the scheduler now does not use it yet. I guess @prodanlabs did it by himself.

@Garrybest
Copy link
Member

Cool, I like this feature.

@kerthcet
Copy link
Member

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.

@prodanlabs
Copy link
Member

Regarding the issue of multiple schedulers, we can open another issues discussion.

@chaunceyjiang
Copy link
Member Author

So, for this PR, is there anything else I need to update?

@RainbowMango

@kerthcet
Copy link
Member

I have several questions:

  1. If we don't set --plugins, what's the result, it seems like no plugins is registered?
  2. If not all plugins defined in karmada enabled by default, like we have plugin sets A, B, C, D1, D2, we enable A, B, C, D1 by default, but now, we want A, B, C, D2 enabled, D1 disabled, how to cover this, --plugisn="A,B,C,D2,-D1"?

@chaunceyjiang
Copy link
Member Author

If we don't set --plugins, what's the result, it seems like no plugins is registered?

All plugins are enabled by default
image

@RainbowMango
Copy link
Member

@chaunceyjiang Just opened #2170 for the naming thing.

So, for this PR, is there anything else I need to update?

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).

@RainbowMango
Copy link
Member

/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.

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>
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 Jul 20, 2022
@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 Jul 20, 2022
@chaunceyjiang
Copy link
Member Author

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)

@RainbowMango
Copy link
Member

There are resource constraints on GitHub actions in each repo.

Really? Where did you see that?

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)

I know @XiShanYongYe-Chang and @mrlihanbo are trying to figure out the reason, but don't really have a clue yet.
Yeah, we can do that if it is the root cause.

@RainbowMango
Copy link
Member

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.

@XiShanYongYe-Chang
Copy link
Member

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 karmada-apiserver restarts multiple times. Removing the v1.21 k8s cluster may not solve the problem.

We have not figured out the root cause of the CI failure of v1.24. k8s cluster. Can you help figure it out together?

@karmada-bot karmada-bot merged commit 37ffc7d into karmada-io:master Jul 20, 2022
@chaunceyjiang chaunceyjiang deleted the scheduler_plugins branch September 1, 2022 01:20
@Poor12 Poor12 mentioned this pull request Jan 6, 2023
6 tasks
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

9 participants