Repository navigation
fix: evict stale instance cache entries in List() - #9242
Merged
Merged
Conversation
Contributor
|
Snapshot successfully published to |
1 of 3 tasks
1 of 3 tasks
ryan-mist
added a commit
to ryan-mist/karpenter-provider-aws
that referenced
this pull request
Aug 14, 2026
1 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9226
Description
The instance cache TTL was recently changed from 1 minute to
NoExpirationto support zonal shift. However,List()only adds entries to the cache and never removes entries for instances that EC2 no longer returns. We rely on these instances being removed from the cache as part of node termination - https://github.com/kubernetes-sigs/karpenter/blob/7593c9c8e04d961788940047f70cd00411e83823/pkg/controllers/node/termination/controller.go#L117:L128This can cause spot-interrupted, IODCR-interrupted, or manually terminated instances to persist as ghost Nodes / NodeClaims in some cases (I've only been able to do this by turning off graceful node shutdown).
This PR changes List() to remove entries for instances that EC2 no longer returns if we have not shifted out of the zone
How was this change tested?
Before PR
Interrupted instance through reclaiming capacity in IODCRs:
Instance is terminated, but the NodeClaim and Node are still around:
After PR
Interrupted instance through reclaiming capacity in IODCRs:
Instance is terminated, and the NodeClaim and Node are removed shortly after:
Does this change impact docs?
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.