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

Invert main strategy loop for performance and customizability #556

Merged
merged 1 commit into from
Apr 28, 2021

Conversation

damemi
Copy link
Contributor

@damemi damemi commented Apr 26, 2021

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:

  1. Wastes time for strategies that aren't enabled

  2. Only allows strategies to be run in a fixed order

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

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 26, 2021
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 26, 2021
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 27, 2021
f(ctx, rs.Client, strategy, nodes, podEvictor)
}
} else {
klog.Errorf("Unknown strategy name '%s', exiting", name)
Copy link
Contributor

@ingvagabund ingvagabund Apr 28, 2021

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.

Copy link
Contributor Author

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

@ingvagabund
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 28, 2021
@k8s-ci-robot k8s-ci-robot merged commit 724ff8a into kubernetes-sigs:master Apr 28, 2021
briend pushed a commit to briend/descheduler that referenced this pull request Feb 11, 2022
Invert main strategy loop for performance and customizability
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants