-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Moved node condition filter into a predicates. #50362
Conversation
/cc @gmarek |
If there's a customer configuration, do we need to add 'CheckNodeCondition' by default to keep backward compatibility? |
@k82cn - I think we should, especially that scheduler should behave the same way as before if flags are disabled. |
// - NodeReady condition status is ConditionTrue, | ||
// - NodeOutOfDisk condition status is ConditionFalse, | ||
// - NodeNetworkUnavailable condition status is ConditionFalse. | ||
if cond.Type == v1.NodeReady && cond.Status != v1.ConditionTrue { |
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.
I find cond.Type == v1.NodeReady && cond.Status == v1.ConditionFalse
easier to read WDYT @k82cn ? (same goes for the checks below)
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 can only schedule pod to ready node, neither False
nor Unknown
.
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.
yup indeed forgot the unknown
one
165b4be
to
814cc56
Compare
/retest |
@@ -99,6 +100,16 @@ func RegisterFitPredicate(name string, predicate algorithm.FitPredicate) string | |||
return RegisterFitPredicateFactory(name, func(PluginFactoryArgs) algorithm.FitPredicate { return predicate }) | |||
} | |||
|
|||
// RegisterRequiredFitPredicate registers a fit predicate with the algorithm registry, | |||
// it's always included in configuration. Returns the name with which the predicate was registered. | |||
func RegisterRequiredFitPredicate(name string, predicate algorithm.FitPredicate) string { |
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.
I don't like this - it should be a normal predicate, exactly as fit resources and stuff. Is someone want to break their cluster they're free to do so.
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.
this is for customer configuration; if the scheduler is configured by customer's conf, they will not include node condition check until updating scheduler conf.
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.
@gmarek - Is it too risky to have it ?
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.
I am not sure about this either. The way this method is written implies that this is a new first class way of adding "required predicates". I would remove this method and requiredFitPredicateMap
and would add this predicate to the predicates
map hard-codedly in getFitPredicateFunctions
with a TODO that this hard-coded predicate is there for backward compatibility and should be removed in a couple of releases.
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.
I'm okay with these solutions as long as this ensures backward compatibility, @gmarek WDYT ?
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 someone want to break their cluster they're free to do so.
I think no one want to break their cluster, but they may not know the admission in kubelet. We may also mark the predicates that used by kubelet as required, so maybe a function is better :).
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.
I agree with @bsalamat. Also somehow marking predicates used by kubelet sounds like a good thing to do.
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.
@bsalamat , does kubelet
case make sense to you?
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.
Yes, it does, but we should probably choose a different name for this function and the associated map to make it clear why these predicates are treated differently.
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.
Updated to RegistEssentialFitPredicates
:).
@@ -771,7 +771,7 @@ func (f *ConfigFactory) getPluginArgs() (*PluginFactoryArgs, error) { | |||
ReplicaSetLister: f.replicaSetLister, | |||
StatefulSetLister: f.statefulSetLister, | |||
// All fit predicates only need to consider schedulable nodes. |
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.
Please remove this comment.
} | ||
} | ||
|
||
// Ignore nodes that are marked unschedulable |
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.
Please remove this comment.
@@ -1301,6 +1301,38 @@ func CheckNodeDiskPressurePredicate(pod *v1.Pod, meta interface{}, nodeInfo *sch | |||
return true, nil, nil | |||
} | |||
|
|||
// CheckNodeConditionPredicate checks if a pod can be scheduled on a node | |||
// reporting out of disk, network unavailable and not ready condition. |
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.
optional: Please add to the comment that this predicate doesn't use pod
and checks node condition ignoring the pod
.
@@ -99,6 +100,16 @@ func RegisterFitPredicate(name string, predicate algorithm.FitPredicate) string | |||
return RegisterFitPredicateFactory(name, func(PluginFactoryArgs) algorithm.FitPredicate { return predicate }) | |||
} | |||
|
|||
// RegisterRequiredFitPredicate registers a fit predicate with the algorithm registry, | |||
// it's always included in configuration. Returns the name with which the predicate was registered. | |||
func RegisterRequiredFitPredicate(name string, predicate algorithm.FitPredicate) string { |
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.
I am not sure about this either. The way this method is written implies that this is a new first class way of adding "required predicates". I would remove this method and requiredFitPredicateMap
and would add this predicate to the predicates
map hard-codedly in getFitPredicateFunctions
with a TODO that this hard-coded predicate is there for backward compatibility and should be removed in a couple of releases.
/retest |
/retest |
@gmarek LGTY ? |
@k82cn Please do not squash your commits during the review process: https://github.com/kubernetes/community/blob/master/contributors/devel/pull-requests.md#6-squashing-and-commit-titles |
/retest |
/lgtm Thanks, @k82cn! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bsalamat, k82cn Associated issue: 50360 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 |
/retest Review the full test history for this PR. |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
Hey @k82cn, One of the GPU tests started failing after this PR: First failed run: https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/logs/ci-kubernetes-e2e-gke-gpu/647?log#log Can you please take a look? |
@k82cn Could you please take a look at the broken test? |
sure :). |
One interesting thing is that: seems calico is deployed by deployment; the network is unavailable before it's deployed. By default, we'll use DaemonSet for calico; the DaemonSet will tolerate network unavailable to start calico daemons :). Let me check what happened for this case.
|
@mindprince , @bsalamat , do you know how to check deploy script for gpu e2e test? I'd like to know why we deploy calico by Deployment. |
@k82cn While we could look into the script, I am a bit worried that this change may break similar deployments. Do you know why we see this change of behavior? My understanding is that this PR should not change behavior of the system. |
@bsalamat , yes, this PR did not change behavior of system; I'd like to check whether other change than this PR for gpu e2e test, my understanding is that we can not deploy calico by Deployment. |
This was the only change between the last successful run and the first failure. |
@mindprince , I means the change to deploy script. I'm not sure where to check it. |
There were no changes in test-infra (it stayed at kubernetes/test-infra@d3713c353) between the last successful run and the first failed run. |
Good, let me check it :). |
Automatic merge from submit-queue (batch tested with PRs 49342, 50581, 50777) Update RegisterMandatoryFitPredicate to avoid double register. **What this PR does / why we need it**: In #50362 , we introduced `RegisterMandatoryFitPredicate` to make some predicates always included by scheduler. This PRs is to improve it by avoiding double register: `RegisterFitPredicate` and `RegisterMandatoryFitPredicate` **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #50360 **Release note**: ```release-note None ```
#50884 is used for the flaky e2e test. |
Automatic merge from submit-queue Revert kubernetes#50362. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: part of kubernetes#50884 **Release note**: ```release-note None ```
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #50360Release note: