-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Scheduler Framework based PredicateChecker #2709
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
Scheduler Framework based PredicateChecker #2709
Conversation
b200caa
to
3bf6113
Compare
// Ignoring error here is safe - if a test doesn't specify valid estimatorName, | ||
// it either doesn't need one, or should fail when it turns out to be nil. | ||
estimatorBuilder, _ := estimator.NewEstimatorBuilder(options.EstimatorName) | ||
predicateChecker, _ := simulator.NewTestPredicateChecker() |
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 think you should ignore error (at least not without providing an explanation like the call above).
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.
Changed function to return error (extracted to separate PR: #2782).
And if NewTestPredicateChecker
returns error I pass it via return.
ni2.SetNode(node2) | ||
|
||
predicateChecker := NewTestPredicateChecker() | ||
predicateChecker, _ := NewSchedulerBasedPredicateChecker(clientsetfake.NewSimpleClientset()) |
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.
assert.NoError?
snapshot := scheduler_snapshot.NewEmptySnapshot() | ||
|
||
sched, err := scheduler.New( | ||
volumeBinder := scheduler_volumebinder.NewVolumeBinder( |
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 wonder if we shouldn't give this some kind of fake kubeClient? It already has all the informers, it only needs kubeClient for mutating API calls. Obviously it shouldn't happen anyway, since we're only doing the filtering step and not a binding step, but it still feels safer not to give it a real client at all. 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.
Ping
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.
Based on input from @ahg-g we need to pass real kubeclient here.
if !p.enableAffinityPredicate && predInfo.Name == affinityPredicateName { | ||
continue | ||
func (p *PredicateChecker) CheckPredicates(pod *apiv1.Pod, nodeInfo *scheduler_nodeinfo.NodeInfo) *PredicateError { | ||
state := scheduler_framework.NewCycleState() |
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 doesn't actually contain the node we're considering (since it's not part of snapshot). Doesn't that basically negate any benefits of running PreFilters?
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.
Fixed in followup commits were we introduce ClusterSnapshot
3bf6113
to
2c96cbb
Compare
2c96cbb
to
8a5cadd
Compare
ffd3210
to
87e581a
Compare
f3d8e94
to
1ecec77
Compare
1ecec77
to
6e95320
Compare
Please extract "Tweaks to update-vendor.sh" to a separate PR and rebase |
schedulingError: err, | ||
}) | ||
} | ||
|
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.
nit: remove emtpy line
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.
It was only in intermediate commit. Removed anyway.
|
ready := kube_util.IsNodeReadyAndSchedulable(nodeInfo.Node()) | ||
if !ready { | ||
return false, []predicates.PredicateFailureReason{predicates.NewFailureReason("node is unready")}, nil | ||
return false, []predicates.PredicateFailureReason{predicates.NewPredicateFailureError("todo", "node is unready")}, nil |
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.
todo?
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.
reverted.
"Get rid of removed predicates.NewFailureReason" really doesn't seem to do what it advertises - it's just an error message change. |
} | ||
|
||
// IsNodeReadyAndSchedulablePredicate checks if node is ready. | ||
func IsNodeReadyAndSchedulablePredicate(pod *apiv1.Pod, meta predicates.Metadata, nodeInfo *schedulernodeinfo.NodeInfo) (bool, |
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.
TODO: verify if this doesn't break "GPU hack" where we override node conditions to pretend it's still booting up.
limitations under the License. | ||
*/ | ||
|
||
package simulator |
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.
TODO: make sure this is actually deleted somewhere in this chain
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 will do that as last commit in the chain (maybe in separate PR) which will also address TODO is PredicateChecker
interface.
I do not want to do it right now as this commit will with high probability conflict with any change on this PR. And I expect some changes more as we are during review.
} | ||
|
||
// GenericPredicateError return a generic instance of PredicateError to be used in context where predicate name is | ||
// unknown (hack - to be removed) |
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.
Is it actually removed later on? It's not entirely clear to me how you would do that.
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 are using that for FitsAnyNode. And yeah, to remove that I would need to change interface of that a lot and I do not see a benefit. Will remove the comment.
cd5dc18
to
6f834ac
Compare
Superseded by #2796 |
Follow-up todo list:
TestGetRegion
Future improvements: