-
Notifications
You must be signed in to change notification settings - Fork 748
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
Knob to disable/enable leaked eni cleanup #1641
Changes from 1 commit
a37e439
83b6c18
95cfa18
5354cf0
397b826
d1ab49f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,11 @@ const ( | |
eniClusterTagKey = "cluster.k8s.amazonaws.com/name" | ||
additionalEniTagsEnvVar = "ADDITIONAL_ENI_TAGS" | ||
reservedTagKeyPrefix = "k8s.amazonaws.com" | ||
clusterNameTagKeyFormat = "kubernetes.io/cluster/%s" | ||
clusterNameTagValue = "owned" | ||
|
||
networkInterfaceOwnerTagKey = "eks:eni:owner" | ||
networkInterfaceOwnerTagValue = "amazon-vpc-cni" | ||
// UnknownInstanceType indicates that the instance type is not yet supported | ||
UnknownInstanceType = "vpc ip resource(eni ip limit): unknown instance type" | ||
|
||
|
@@ -371,7 +376,7 @@ func (i instrumentedIMDS) GetMetadataWithContext(ctx context.Context, p string) | |
} | ||
|
||
// New creates an EC2InstanceMetadataCache | ||
func New(useCustomNetworking, disableENIProvisioning, v4Enabled, v6Enabled bool) (*EC2InstanceMetadataCache, error) { | ||
func New(useCustomNetworking, disableENIProvisioning, v4Enabled, v6Enabled, disableLeakedENICollection bool) (*EC2InstanceMetadataCache, error) { | ||
//ctx is passed to initWithEC2Metadata func to cancel spawned go-routines when tests are run | ||
ctx := context.Background() | ||
|
||
|
@@ -411,7 +416,7 @@ func New(useCustomNetworking, disableENIProvisioning, v4Enabled, v6Enabled bool) | |
} | ||
|
||
// Clean up leaked ENIs in the background | ||
if !disableENIProvisioning { | ||
if !disableENIProvisioning && !disableLeakedENICollection { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking about it..Why don't we disable this for v6 completely since v6 support in PD mode will not be creating any additional ENIs? We only have/need Primary ENI in v6 PD mode.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we can. Only catch is if they moved from v4 to v6 cluster and there are leaked ENIs. Maybe should be fine? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, v6 cluster will have to be a brand new cluster and more importantly the proposed IPv6 IAM policy for an IPv6 cluster will not have permissions to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Say in future if we support custom networking with v6 then we might still need this logic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, we might but we can probably remove the v6 check at that point along with v6 specific checks we placed around custom nw code. Problem I see with this right now is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah makes sense to disable it for now until we have actual support for custom networking |
||
go wait.Forever(cache.cleanUpLeakedENIs, time.Hour) | ||
} | ||
|
||
|
@@ -828,13 +833,16 @@ func (cache *EC2InstanceMetadataCache) createENI(useCustomCfg bool, sg []*string | |
// buildENITags computes the desired AWS Tags for eni | ||
func (cache *EC2InstanceMetadataCache) buildENITags() map[string]string { | ||
tags := map[string]string{ | ||
eniNodeTagKey: cache.instanceID, | ||
eniNodeTagKey: cache.instanceID, | ||
networkInterfaceOwnerTagKey: networkInterfaceOwnerTagValue, | ||
} | ||
|
||
// If clusterName is provided, | ||
// tag the ENI with "cluster.k8s.amazonaws.com/name=<cluster_name>" | ||
// and "kubernetes.io/cluster/<cluster-name>: owned" | ||
if cache.clusterName != "" { | ||
tags[eniClusterTagKey] = cache.clusterName | ||
tags[fmt.Sprintf(clusterNameTagKeyFormat, cache.clusterName)] = clusterNameTagValue | ||
} | ||
for key, value := range cache.additionalENITags { | ||
tags[key] = value | ||
|
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.
We already add a
cluster name
tag -amazon-vpc-cni-k8s/pkg/awsutils/awsutils.go
Line 837 in 88c1223