-
Notifications
You must be signed in to change notification settings - Fork 669
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
Invert main strategy loop for performance and customizability #556
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: damemi 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 |
602980f
to
bc65881
Compare
pkg/descheduler/descheduler.go
Outdated
f(ctx, rs.Client, strategy, nodes, podEvictor) | ||
} | ||
} else { | ||
klog.Errorf("Unknown strategy name '%s', exiting", name) |
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.
Maybe skipping instead of exiting? Exiting might give impression the descheduler is aborting actually.
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.
Oh, yeah I actually am just skipping... updated the message to say that
bc65881
to
feae158
Compare
/lgtm |
Invert main strategy loop for performance and customizability
I noticed this while thinking about the new API options we started discussing in #486
Right now we are checking against every strategy function and then seeing if it's enabled. This does 2 things:
Wastes time for strategies that aren't enabled
Only allows strategies to be run in a fixed order
is probably negligible, but 2. is something we should consider providing. I don't know if the current order is hardcoded for a reason. There also hasn't been any demand for this specific functionality that I know of, but while we are considering improvements to the API I think a change like this could make it more flexible.
Either way, this does also add an error for invalid strategy names (where it currently just silently skips them)