-
Notifications
You must be signed in to change notification settings - Fork 408
fix: Improve Karpenter memory when using Node Overlay with copy-on-write #2675
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
base: main
Are you sure you want to change the base?
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: GnatorX The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Pull Request Test Coverage Report for Build 20491526894Details
💛 - Coveralls |
|
Thanks for testing too! |
|
A comment that came from working group meeting, @jmdeal, was that we want to ensure we won't affect the instance type cache of any provider. This code shouldn't because we are still making a copy (similar to the original implementation) but instead of a deep copy, we are doing a shallow copy. Because of this, we aren't changing any of the underlying objects directly but rather the copy of it. The main difference here is that rather than recreating all parts of the object, we are copying the reference to parts of the object and only change the parts that have been change. This should not affect the underlying object in anyway. |
jmdeal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have too much feedback, the logic looks good to me and I appreciate the data you've included.
|
Updated based on comments. Let me know what you think. |

Fixes #2655
Problem
Full deep copying of instance types caused excessive memory usage in deployments with many instance types and node pools (~1GB+ for 200 types × 5 pools).
Solution
Replace full deep copy with selective copying:
applyPriceOverlays()for granular offering copyingBefore
After
Results
Before: red line, After: Orange

Before:
After:
Testing
All tests pass. Comprehensive memory and benchmark tests added.
Files
pkg/controllers/nodeoverlay/store.go- Implementationpkg/controllers/nodeoverlay/store_memory_test.go- Memory testspkg/controllers/nodeoverlay/store_bench_test.go- BenchmarksMakefile- New test targetsReviewers
Key areas:
apply()methodapplyPriceOverlays()By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.