-
Notifications
You must be signed in to change notification settings - Fork 67
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: properly garbage collecting orphaned network interfaces #642
base: main
Are you sure you want to change the base?
Conversation
nodeClaim.Labels = labels | ||
nodeClaim.Annotations = annotations | ||
nodeClaim.CreationTimestamp = metav1.Time{Time: *vm.Properties.TimeCreated} | ||
nodeClaim.CreationTimestamp = metav1.Time{Time: lo.FromPtr(vm.Properties.TimeCreated)} |
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.
this path was executed when my List query returned an empty result.
In the case where ARG has an outage, garbage collection will break, but there is no need to panic here in that scenario. So switched to lo.FromPtr() instead of normal dereference.
Testing this locally. Initially after our first scaleup, we were at 810 network interfaces. After garbage collection ran we can see that we deleted 435 network interfaces, and were left with 375 for our 375 nodes. ~/dev/focus/karpenter-provider-azure (bsoghigian/network-interface-gc*) » cat logs.txt| grep "garbage collected NIC" | wc -l sillygoose@Bryces-MacBook-Pro |
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.
Realize this is still draft to be cleaned up, so apologies if feedback is too early. Leaving some comments, overall I think I would be tempted to have a separate "networkinterface.garbagecollection" controller - unless there is a good reason not to.
Pull Request Test Coverage Report for Build 12738183194Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
"karpenter.sh_cluster": lo.ToPtr("test-cluster"), | ||
"karpenter.sh_nodepool": lo.ToPtr(nodepoolName), |
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.
Should use constants from instance provider? But then cyclic dependency?
…tor of arg related functions to their own file
…ctoring gc functions slightly
…ate between them to prevent conflicts in nic deletion calls
…ontroller to avoid attempts to delete nics that are managed by a vm
…cleaner state list
…ased on existing karp-core pattern
9eb0362
to
20c6625
Compare
GetNic(context.Context, string, string) (*armnetwork.Interface, error) | ||
DeleteNic(context.Context, string) error | ||
ListNics(context.Context) ([]*armnetwork.Interface, error) |
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.
Future refactor here would be to factor out these calls into a network interface provider.
Fixes #92
Description
This introduces a garbage collection controller that will remove network interfaces that are orphaned.
How was this change tested?
Does this change impact docs?
Release Note