-
Notifications
You must be signed in to change notification settings - Fork 40k
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
kube-scheduler: Use default predicates/prioritizers if they are unspecified in the policy config #59363
Conversation
0129075
to
010fbd4
Compare
pkg/scheduler/factory/factory.go
Outdated
for _, predicate := range policy.Predicates { | ||
glog.V(2).Infof("Registering predicate: %s", predicate.Name) | ||
predicateKeys.Insert(RegisterCustomFitPredicate(predicate)) | ||
if len(policy.Predicates) == 0 { |
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 you change it to use defaults only when the predicates and/or priorities are not provided? We would like to keep the possibility of bypassing all predicate or priority functions.
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.
Done.
// Test configures a scheduler from a policy that does not contain any | ||
// predicates or priorities. | ||
// The predicates or priorities from DefaultProvider will be used. | ||
func TestCreateFromConfigWithEmptyPredicatesAndPriorities(t *testing.T) { |
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 need an integration test to cover all the logic, including the decoding of policy config. Coding an integration test is similar. Please see this.
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.
Done.
010fbd4
to
b9707ba
Compare
/retest |
…does not specify them
b9707ba
to
f69eaa3
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.
Thanks, @yguo0905!
/lgtm
@@ -541,3 +513,23 @@ func TestSkipPodUpdate(t *testing.T) { | |||
} | |||
} | |||
} | |||
|
|||
func newConfigFactory(client *clientset.Clientset, hardPodAffinitySymmetricWeight int32) scheduler.Configurator { |
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.
Thanks for adding this!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bsalamat, yguo0905 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue (batch tested with PRs 59394, 58769, 59423, 59363, 59245). If you want to cherry-pick this change to another branch, please follow the instructions here. |
We now use default predicates/priorities if they are unspecified in the policy config (kubernetes#59363). The other example in ./scheduler-policy-config.json shows how to use priorities and predicates. Let's use this example to show how to use extenders. When you are using extenders you don't necessarily want to mess with priorities and predicates (kubernetes#45188).
We now use default predicates/priorities if they are unspecified in the policy config (kubernetes/kubernetes#59363). The other example in ./scheduler-policy-config.json shows how to use priorities and predicates. Let's use this example to show how to use extenders. When you are using extenders you don't necessarily want to mess with priorities and predicates (kubernetes/kubernetes#45188).
We now use default predicates/priorities if they are unspecified in the policy config (kubernetes/kubernetes#59363). The other example in ./scheduler-policy-config.json shows how to use priorities and predicates. Let's use this example to show how to use extenders. When you are using extenders you don't necessarily want to mess with priorities and predicates (kubernetes/kubernetes#45188). Also remove duplicate file.
We now use default predicates/priorities if they are unspecified in the policy config (kubernetes/kubernetes#59363). The other example in ./scheduler-policy-config.json shows how to use priorities and predicates. Let's use this example to show how to use extenders. When you are using extenders you don't necessarily want to mess with priorities and predicates (kubernetes/kubernetes#45188). Also remove duplicate file.
We now use default predicates/priorities if they are unspecified in the policy config (kubernetes/kubernetes#59363). The other example in ./scheduler-policy-config.json shows how to use priorities and predicates. Let's use this example to show how to use extenders. When you are using extenders you don't necessarily want to mess with priorities and predicates (kubernetes/kubernetes#45188). Also remove duplicate file.
What this PR does / why we need it:
The scheduler has built-in default sets of predicate/prioritizer that are applied on pod scheduling. It can also take a policy config file where predicate/prioritizer and extender settings can be specified. The current behavior is that if we want to configure an extender using the policy config, we have to also provide the default predicate/prioritizer settings. Otherwise, the empty predicate/prioritizer sets will be used.
This is inconvenient, and it's hard to keep the policy config up to date with the scheduler's defaults. This PR changes the scheduler to use the default predicate/prioritizer sets if they are unspecified in the policy config. But an empty list would bypass non-mandatory predicates/prioritizers.
This will change the behavior of a policy config that does not specify (but not empty list) predicate/prioritizer, but it's unlike someone is using such config in practice.
Special notes for your reviewer:
I think it makes sense to have this in 1.9 as well because
Release note:
/sig scheduling
/assign @bsalamat
/cc @vishh