Skip to content

Conversation

alam0rt
Copy link
Contributor

@alam0rt alam0rt commented Jan 11, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

We encountered an issue where the curSize cached value would be decremented every time an already terminating instance was signaled for termination again. This caused the desired size of the ASG to dwindle to min size and was made worse when we introduced a change that kept instances in a terminating state for longer than we previously did.

The cause of this it seems is because cluster-autoscaler doesn't take any heed of already terminating instances and blindly decrements the curSize value,

This PR addresses that by caching the lifecycle state of the instance.

Which issue(s) this PR fixes:

Fixes #4095

Special notes for your reviewer:

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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 11, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @alam0rt!

It looks like this is your first PR to kubernetes/autoscaler 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/autoscaler has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 11, 2023
@k8s-ci-robot k8s-ci-robot requested a review from jaypipes January 11, 2023 05:52
@alam0rt alam0rt marked this pull request as ready for review January 11, 2023 05:57
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 11, 2023
@alam0rt alam0rt marked this pull request as draft January 11, 2023 06:02
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 11, 2023
Copy link
Contributor

@grosser grosser left a comment

Choose a reason for hiding this comment

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

🎉

@x13n
Copy link
Member

x13n commented Feb 28, 2023

Looks like this was already lgtmed by @grosser . Assigning aws owners for approval.

/assign @jaypipes @gjtempleton

Copy link
Member

@gjtempleton gjtempleton left a comment

Choose a reason for hiding this comment

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

One query.

@gjtempleton
Copy link
Member

Can you squash this down to one or two commits please, and then happy to get this merged.

alam0rt added 2 commits May 11, 2023 15:37
Avoid deadlocking by locking mutex twice

Instantiate test instance with lifecycle state

Make method private
@alam0rt alam0rt force-pushed the fix-issue-where-terminating-instances-scale-down-asg-to-min branch from 7cdba40 to 21e1f5b Compare May 11, 2023 05:39
@grosser
Copy link
Contributor

grosser commented May 11, 2023

@gjtempleton update was pushed

@gjtempleton
Copy link
Member

Thanks!
/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 18, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alam0rt, gjtempleton, grosser

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 18, 2023
@k8s-ci-robot k8s-ci-robot merged commit 47af9cc into kubernetes:master May 18, 2023
abhinavdahiya pushed a commit to lyft/autoscaler that referenced this pull request Sep 28, 2023
… instances (kubernetes#5411)

Merge pull request kubernetes#5411 from alam0rt/fix-issue-where-terminating-instances-scale-down-asg-to-min

Track lifecycle and skip terminating already terminating instances
abhinavdahiya pushed a commit to lyft/autoscaler that referenced this pull request Sep 28, 2023
…nating-instances-scale-down-asg-to-min

Track lifecycle and skip terminating already terminating instances
abhinavdahiya pushed a commit to lyft/autoscaler that referenced this pull request Sep 28, 2023
… instances (kubernetes#5411)

Merge pull request kubernetes#5411 from alam0rt/fix-issue-where-terminating-instances-scale-down-asg-to-min

Track lifecycle and skip terminating already terminating instances
tomwans added a commit to lyft/autoscaler that referenced this pull request Sep 29, 2023
Patch comes from upstream:

43c511d
21e1f5b

kubernetes#5411

This has been modified to apply cleanly to 1.22.3
abhinavdahiya pushed a commit to lyft/autoscaler that referenced this pull request Oct 2, 2023
…nating-instances-scale-down-asg-to-min

Track lifecycle and skip terminating already terminating instances
tomwans added a commit to lyft/autoscaler that referenced this pull request Oct 9, 2023
Brings in:

kubernetes#5411
kubernetes#6166

But the code is so different I manually brought it up to speed.
tomwans added a commit to lyft/autoscaler that referenced this pull request Oct 11, 2023
bring up AWS patch for termination
Brings in:

kubernetes#5411
kubernetes#6166

But the code is so different I manually brought it up to speed.

Also, I added a patch to make tests pass in the latest version of Go.
murongl-lyft pushed a commit to lyft/autoscaler that referenced this pull request Dec 4, 2023
…nating-instances-scale-down-asg-to-min

Track lifecycle and skip terminating already terminating instances
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/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cluster-autoscaler][AWS] Repeated deletion every 10s of same node takes AWS ASG down to min size killing multiple running pods

6 participants