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

add least-nodes expander to cluster-autoscaler #6792

Merged

Conversation

com6056
Copy link
Contributor

@com6056 com6056 commented May 3, 2024

What type of PR is this?

What this PR does / why we need it:

Adds a new least-nodes expander 🎉

Which issue(s) this PR fixes:

No related issues

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Added a new `least-nodes` expander

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 3, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @com6056. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 3, 2024
@com6056
Copy link
Contributor Author

com6056 commented May 3, 2024

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label May 3, 2024
@@ -37,6 +37,7 @@ func (m *mostpods) BestOptions(expansionOptions []expander.Option, nodeInfo map[
for _, option := range expansionOptions {
if len(option.Pods) == maxPods {
maxOptions = append(maxOptions, option)
continue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny little perf improvement

@com6056 com6056 force-pushed the jrodgers-expander-least-nodes branch from 498cd03 to fa19529 Compare May 3, 2024 21:00
@com6056 com6056 force-pushed the jrodgers-expander-least-nodes branch from fa19529 to dc99ab3 Compare May 3, 2024 21:01
@drmorr0
Copy link
Contributor

drmorr0 commented May 4, 2024

You can write/run your own expanders using the grpc expander option: https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler/expander/grpcplugin

My personal opinion is that it's better for users to add new expanders using this approach, rather than adding more special-case expanders into the core autoscaler code.

@MaciekPytel
Copy link
Contributor

MaciekPytel commented May 6, 2024

I generally agree with @drmorr0, but this expander seems both simple and very generic (*). As such I can imagine it being useful enough for many other users, so personally I'm ok letting it in.

(*) Preference for large nodes is a reasonable high-level strategy, as larger nodes suffer less from "system tax" and resource fragmentation. In small clusters the downside may be lack of HA, but for a cluster with hundreds of nodes I think it is a decent strategy. And there is nothing specific to a provider or environment in the implementation, it will work anywhere as the only input it relies on is absolutely necessary for CA to be able to scale-up at all.

edit: Specifically - I'm ok to lgtm this once the review comments are addressed.

@MaciekPytel
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 6, 2024
@com6056 com6056 requested a review from MaciekPytel May 6, 2024 23:28
@MaciekPytel
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 7, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: com6056, MaciekPytel

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 May 7, 2024
@k8s-ci-robot k8s-ci-robot merged commit daaf243 into kubernetes:master May 7, 2024
6 checks passed
@com6056
Copy link
Contributor Author

com6056 commented May 29, 2024

/cherrypick cluster-autoscaler-release-1.27

@k8s-infra-cherrypick-robot

@com6056: only kubernetes org members may request cherry picks. If you are already part of the org, make sure to change your membership to public. Otherwise you can still do the cherry-pick manually.

In response to this:

/cherrypick cluster-autoscaler-release-1.27

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@com6056
Copy link
Contributor Author

com6056 commented May 29, 2024

@MaciekPytel would you be able to run the cherry-pick command for me? Thanks! 🙏

@rljohnsn
Copy link

Would very much like to utilize this expander. Currently our similar node groups spread across AZ's are unevenly scaled. Always bumping the pool that has fewer nodes seams like the easiest logic to keep them all relatively equal.

@jacobrandall
Copy link

@MaciekPytel would you be able to run the cherry-pick command for me? Thanks! 🙏

Also looking to use this, any chance it could get into a release soon?

com6056 pushed a commit to com6056/autoscaler that referenced this pull request Aug 6, 2024
…st-nodes

add least-nodes expander to cluster-autoscaler
com6056 pushed a commit to com6056/autoscaler that referenced this pull request Aug 6, 2024
…st-nodes

add least-nodes expander to cluster-autoscaler
com6056 pushed a commit to com6056/autoscaler that referenced this pull request Aug 6, 2024
…st-nodes

add least-nodes expander to cluster-autoscaler
com6056 pushed a commit to com6056/autoscaler that referenced this pull request Aug 6, 2024
…st-nodes

add least-nodes expander to cluster-autoscaler
k8s-ci-robot added a commit that referenced this pull request Aug 21, 2024
cherry-pick least-nodes expander from #6792 into 1.30
k8s-ci-robot added a commit that referenced this pull request Aug 21, 2024
cherry-pick least-nodes expander from #6792 into 1.29
k8s-ci-robot added a commit that referenced this pull request Aug 21, 2024
cherry-pick least-nodes expander from #6792 into 1.28
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. area/cluster-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants