From 6d52e1bf657f4f3d9bd6bdb807d20d7ba2d6f988 Mon Sep 17 00:00:00 2001 From: jayanthvn <1111446+jayanthvn@users.noreply.github.com> Date: Fri, 12 Jun 2020 16:26:33 -0700 Subject: [PATCH] =?UTF-8?q?added=20warning=20if=20delete=20on=20terminatio?= =?UTF-8?q?n=20is=20set=20to=20false=20for=20the=20primar=E2=80=A6=20(#102?= =?UTF-8?q?4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added a warning message if delete on termination is set to false for the primary ENI --- pkg/awsutils/awsutils.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/awsutils/awsutils.go b/pkg/awsutils/awsutils.go index a89a0a885a..15c523eae9 100644 --- a/pkg/awsutils/awsutils.go +++ b/pkg/awsutils/awsutils.go @@ -1004,6 +1004,9 @@ func (cache *EC2InstanceMetadataCache) DescribeAllENIs() ([]ENIMetadata, map[str // Collect ENI response into ENI metadata and tags. tagMap := make(map[string]TagMap, len(ec2Response.NetworkInterfaces)) for _, ec2res := range ec2Response.NetworkInterfaces { + if ec2res.Attachment != nil && aws.Int64Value(ec2res.Attachment.DeviceIndex) == 0 && !aws.BoolValue(ec2res.Attachment.DeleteOnTermination) { + log.Warn("Primary ENI will not get deleted when node terminates because 'delete_on_termination' is set to false") + } eniID := aws.StringValue(ec2res.NetworkInterfaceId) eniMetadata := eniMap[eniID] // Check IPv4 addresses