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

Trigger an explicit scale up error when expander filters out all scale-up options #7512

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mtrqq
Copy link
Contributor

@mtrqq mtrqq commented Nov 21, 2024

…ons.

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Cluster autoscaler will silently fail the scale-up in case expander was not able to pick the best option, this change adds logs to capture this behavior as well as changes the status of the scale up from ScaleUpNoOptionsAvailable to ScaleUpError

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

This should not affect expanders as BestOption semantics tells us that this interface is supposed to pick the best option out of available ones and not to filter them out completely even if any are available

Does this PR introduce a user-facing change?


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


@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 21, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @mtrqq. 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 the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 21, 2024
@mtrqq
Copy link
Contributor Author

mtrqq commented Dec 5, 2024

/assign towca

return &status.ScaleUpStatus{
Result: status.ScaleUpNoOptionsAvailable,
PodsRemainUnschedulable: GetRemainingPods(podEquivalenceGroups, skippedNodeGroups),
Result: status.ScaleUpError,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should keep the ScaleUpNoOptionsAvailable status here. The Expander semantics aren't particularly well defined, and we know of existing implementations (at least in the GKE fork) that filter all options out in certain expected scenarios.

We do need more debugability in this scenario though, so the additional logging and correctly setting PodsRemainUnschedulable are very worthwhile additions.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1, I think the improvement should more explicitly inform the user of what happened, not necessarily handle it differently. Also no expander option might be an expected outcome, so we should not really log an error here.

@@ -177,9 +177,10 @@ func (o *ScaleUpOrchestrator) ScaleUp(
// Pick some expansion option.
bestOption := o.autoscalingContext.ExpanderStrategy.BestOption(options, nodeInfos)
if bestOption == nil || bestOption.NodeCount <= 0 {
klog.Errorf("Expander filtered out all options, valid options: %d (this shouldn't happen)", len(options))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Following the other comment, can we actually change the severity to Info here and remove the "this shouldn't happen" part?

podInfos := []status.NoScaleUpInfo{}
for _, eg := range egs {
for _, pod := range eg.Pods {
noScaleUpInfo := status.NoScaleUpInfo{
Copy link
Collaborator

Choose a reason for hiding this comment

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

NoScaleUpInfo should present a complete explanation why each of the node groups couldn't be scaled up to accommodate a given pod. Normally, each node group should be either in SkippedNodeGroups (if the node group is skipped for all pods) or RejectedNodeGroups (if the node group doesn't pass scheduling predicates for a particular group of pods).

In this case, there are some node groups that aren't in either field (because they weren't skipped and the predicates passed for them). We need to add these node groups to one of the fields. We already do that for the atomic scale-up logic, I think we can just reuse markAllGroupsAsUnschedulable with a new Reason. WDYT?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mtrqq
Once this PR has been reviewed and has the lgtm label, please ask for approval from towca. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cluster-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. 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.

4 participants