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

Fix templated nodeinfo names collisions in BinpackingNodeEstimator #4089

Merged
merged 1 commit into from
May 24, 2021

Conversation

bpineau
Copy link
Contributor

@bpineau bpineau commented May 19, 2021

Since a couple of months, both upscale's getUpcomingNodeInfos and the
binpacking estimator uses the same shared DeepCopyTemplateNode function
and inherits its naming pattern, which is great and fixes a long standing bug.

getUpcomingNodeInfos will now enrich the cluster snapshots with
generated nodeinfos and nodes having predictable names (using the nodegroup's
template name, and an incremental ordinal starting at 0) for upcoming nodes.

Later, when it looks for fitting nodes for unschedulable pods, the binpacking
estimator will also build virtual nodes and place them in a snapshot fork to
evaluate scheduler predicates.

Those temporary virtual nodes are built using the same pattern (template name
and an index ordinal also starting at 0) as the one previously used by
getUpcomingNodeInfos, which means it will generate the same nodeinfos/nodes
names for nodegroups having upcoming nodes.

But adding nodes by the same name in an existing cluster snapshot isn't allowed,
and the evaluation attempt will fail. So no nodeInfo from node groups having
upcoming nodes can ever be considered as fitting unschedulable pods.

Practically this blocks re-upscales for nodegroups having upcoming nodes,
which can cause a significant delay (or suboptimal choices among the
possible node groups options). This wasn't the case until recently, as
getUpcomingNodeInfos and the estimator used different naming schemes.

Both upscale's `getUpcomingNodeInfos` and the binpacking estimator now uses
the same shared DeepCopyTemplateNode function and inherits its naming
pattern, which is great as that fixes a long standing bug.

Due to that, `getUpcomingNodeInfos` will enrich the cluster snapshots with
generated nodeinfos and nodes having predictable names (using template name
+ an incremental ordinal starting at 0) for upcoming nodes.

Later, when it looks for fitting nodes for unschedulable pods (when upcoming
nodes don't satisfy those (FitsAnyNodeMatching failing due to nodes capacity,
or pods antiaffinity, ...), the binpacking estimator will also build virtual
nodes and place them in a snapshot fork to evaluate scheduler predicates.

Those temporary virtual nodes are built using the same pattern (template name
and an index ordinal also starting at 0) as the one previously used by
`getUpcomingNodeInfos`, which means it will generate the same nodeinfos/nodes
names for nodegroups having upcoming nodes.

But adding nodes by the same name in an existing cluster snapshot isn't
allowed, and the evaluation attempt will fail.

Practically this blocks re-upscales for nodegroups having upcoming nodes,
which can cause a significant delay.
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 19, 2021
@k8s-ci-robot k8s-ci-robot requested review from feiskyer and Jeffwan May 19, 2021 10:12
@MaciekPytel
Copy link
Contributor

Nice catch! Sorry for introducing that issue :(

/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 24, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bpineau, 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 24, 2021
@k8s-ci-robot k8s-ci-robot merged commit 5ab7792 into kubernetes:master May 24, 2021
k8s-ci-robot added a commit that referenced this pull request Sep 7, 2021
Cluster Autoscaler: Backport #4089 to 1.21
evansheng pushed a commit to airbnb/autoscaler that referenced this pull request Aug 17, 2022
…sions

Fix templated nodeinfo names collisions in BinpackingNodeEstimator
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