@@ -1304,7 +1304,7 @@ func TestEC2InstanceMetadataCache_buildENITags(t *testing.T) {
1304
1304
instanceID : "i-xxxxx" ,
1305
1305
},
1306
1306
want : map [string ]string {
1307
- "node.k8s.amazonaws.com/instance_id" : "i-xxxxx" ,
1307
+ eniNodeTagKey : "i-xxxxx" ,
1308
1308
},
1309
1309
},
1310
1310
{
@@ -1314,8 +1314,9 @@ func TestEC2InstanceMetadataCache_buildENITags(t *testing.T) {
1314
1314
clusterName : "awesome-cluster" ,
1315
1315
},
1316
1316
want : map [string ]string {
1317
- "node.k8s.amazonaws.com/instance_id" : "i-xxxxx" ,
1318
- "cluster.k8s.amazonaws.com/name" : "awesome-cluster" ,
1317
+ eniNodeTagKey : "i-xxxxx" ,
1318
+ eniClusterTagKey : "awesome-cluster" ,
1319
+ eniOwnerTagKey : eniOwnerTagValue ,
1319
1320
},
1320
1321
},
1321
1322
{
@@ -1328,9 +1329,9 @@ func TestEC2InstanceMetadataCache_buildENITags(t *testing.T) {
1328
1329
},
1329
1330
},
1330
1331
want : map [string ]string {
1331
- "node.k8s.amazonaws.com/instance_id" : "i-xxxxx" ,
1332
- "tagKey-1" : "tagVal-1" ,
1333
- "tagKey-2" : "tagVal-2" ,
1332
+ eniNodeTagKey : "i-xxxxx" ,
1333
+ "tagKey-1" : "tagVal-1" ,
1334
+ "tagKey-2" : "tagVal-2" ,
1334
1335
},
1335
1336
},
1336
1337
}
@@ -1375,7 +1376,7 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1375
1376
Filters : []ec2types.Filter {
1376
1377
{
1377
1378
Name : aws .String ("tag-key" ),
1378
- Values : []string {"node.k8s.amazonaws.com/instance_id" },
1379
+ Values : []string {eniNodeTagKey },
1379
1380
},
1380
1381
{
1381
1382
Name : aws .String ("status" ),
@@ -1408,7 +1409,7 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1408
1409
Filters : []ec2types.Filter {
1409
1410
{
1410
1411
Name : aws .String ("tag-key" ),
1411
- Values : []string {"node.k8s.amazonaws.com/instance_id" },
1412
+ Values : []string {eniNodeTagKey },
1412
1413
},
1413
1414
{
1414
1415
Name : aws .String ("status" ),
@@ -1430,11 +1431,11 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1430
1431
Status : "available" ,
1431
1432
TagSet : []ec2types.Tag {
1432
1433
{
1433
- Key : aws .String ("node.k8s.amazonaws.com/instance_id" ),
1434
+ Key : aws .String (eniNodeTagKey ),
1434
1435
Value : aws .String ("i-xxxxx" ),
1435
1436
},
1436
1437
{
1437
- Key : aws .String ("node.k8s.amazonaws.com/createdAt" ),
1438
+ Key : aws .String (eniCreatedAtTagKey ),
1438
1439
Value : aws .String (tenMinuteAgo .Format (time .RFC3339 )),
1439
1440
},
1440
1441
},
@@ -1452,11 +1453,11 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1452
1453
Status : "available" ,
1453
1454
TagSet : []ec2types.Tag {
1454
1455
{
1455
- Key : aws .String ("node.k8s.amazonaws.com/instance_id" ),
1456
+ Key : aws .String (eniNodeTagKey ),
1456
1457
Value : aws .String ("i-xxxxx" ),
1457
1458
},
1458
1459
{
1459
- Key : aws .String ("node.k8s.amazonaws.com/createdAt" ),
1460
+ Key : aws .String (eniCreatedAtTagKey ),
1460
1461
Value : aws .String (tenMinuteAgo .Format (time .RFC3339 )),
1461
1462
},
1462
1463
},
@@ -1473,7 +1474,7 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1473
1474
Filters : []ec2types.Filter {
1474
1475
{
1475
1476
Name : aws .String ("tag-key" ),
1476
- Values : []string {"node.k8s.amazonaws.com/instance_id" },
1477
+ Values : []string {eniNodeTagKey },
1477
1478
},
1478
1479
{
1479
1480
Name : aws .String ("status" ),
@@ -1495,11 +1496,11 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1495
1496
Status : "available" ,
1496
1497
TagSet : []ec2types.Tag {
1497
1498
{
1498
- Key : aws .String ("node.k8s.amazonaws.com/instance_id" ),
1499
+ Key : aws .String (eniNodeTagKey ),
1499
1500
Value : aws .String ("i-xxxxx" ),
1500
1501
},
1501
1502
{
1502
- Key : aws .String ("node.k8s.amazonaws.com/createdAt" ),
1503
+ Key : aws .String (eniCreatedAtTagKey ),
1503
1504
Value : aws .String (tenMinuteAgo .Format (time .RFC3339 )),
1504
1505
},
1505
1506
},
@@ -1522,7 +1523,7 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1522
1523
Filters : []ec2types.Filter {
1523
1524
{
1524
1525
Name : aws .String ("tag-key" ),
1525
- Values : []string {"node.k8s.amazonaws.com/instance_id" },
1526
+ Values : []string {eniNodeTagKey },
1526
1527
},
1527
1528
{
1528
1529
Name : aws .String ("status" ),
@@ -1544,11 +1545,11 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1544
1545
Status : "available" ,
1545
1546
TagSet : []ec2types.Tag {
1546
1547
{
1547
- Key : aws .String ("node.k8s.amazonaws.com/instance_id" ),
1548
+ Key : aws .String (eniNodeTagKey ),
1548
1549
Value : aws .String ("i-xxxxx" ),
1549
1550
},
1550
1551
{
1551
- Key : aws .String ("node.k8s.amazonaws.com/createdAt" ),
1552
+ Key : aws .String (eniCreatedAtTagKey ),
1552
1553
Value : aws .String (now .Format (time .RFC3339 )),
1553
1554
},
1554
1555
},
@@ -1571,7 +1572,7 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1571
1572
Filters : []ec2types.Filter {
1572
1573
{
1573
1574
Name : aws .String ("tag-key" ),
1574
- Values : []string {"node.k8s.amazonaws.com/instance_id" },
1575
+ Values : []string {eniNodeTagKey },
1575
1576
},
1576
1577
{
1577
1578
Name : aws .String ("status" ),
@@ -1604,7 +1605,7 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1604
1605
Filters : []ec2types.Filter {
1605
1606
{
1606
1607
Name : aws .String ("tag-key" ),
1607
- Values : []string {"node.k8s.amazonaws.com/instance_id" },
1608
+ Values : []string {eniNodeTagKey },
1608
1609
},
1609
1610
{
1610
1611
Name : aws .String ("status" ),
@@ -1630,15 +1631,15 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1630
1631
Status : "available" ,
1631
1632
TagSet : []ec2types.Tag {
1632
1633
{
1633
- Key : aws .String ("node.k8s.amazonaws.com/instance_id" ),
1634
+ Key : aws .String (eniNodeTagKey ),
1634
1635
Value : aws .String ("i-xxxxx" ),
1635
1636
},
1636
1637
{
1637
- Key : aws .String ("node.k8s.amazonaws.com/createdAt" ),
1638
+ Key : aws .String (eniCreatedAtTagKey ),
1638
1639
Value : aws .String (tenMinuteAgo .Format (time .RFC3339 )),
1639
1640
},
1640
1641
{
1641
- Key : aws .String ("cluster.k8s.amazonaws.com/name" ),
1642
+ Key : aws .String (eniClusterTagKey ),
1642
1643
Value : aws .String ("awesome-cluster" ),
1643
1644
},
1644
1645
},
@@ -1656,15 +1657,15 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1656
1657
Status : "available" ,
1657
1658
TagSet : []ec2types.Tag {
1658
1659
{
1659
- Key : aws .String ("node.k8s.amazonaws.com/instance_id" ),
1660
+ Key : aws .String (eniNodeTagKey ),
1660
1661
Value : aws .String ("i-xxxxx" ),
1661
1662
},
1662
1663
{
1663
- Key : aws .String ("node.k8s.amazonaws.com/createdAt" ),
1664
+ Key : aws .String (eniCreatedAtTagKey ),
1664
1665
Value : aws .String (tenMinuteAgo .Format (time .RFC3339 )),
1665
1666
},
1666
1667
{
1667
- Key : aws .String ("cluster.k8s.amazonaws.com/name" ),
1668
+ Key : aws .String (eniClusterTagKey ),
1668
1669
Value : aws .String ("awesome-cluster" ),
1669
1670
},
1670
1671
},
@@ -1681,7 +1682,7 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1681
1682
Filters : []ec2types.Filter {
1682
1683
{
1683
1684
Name : aws .String ("tag-key" ),
1684
- Values : []string {"node.k8s.amazonaws.com/instance_id" },
1685
+ Values : []string {eniNodeTagKey },
1685
1686
},
1686
1687
{
1687
1688
Name : aws .String ("status" ),
@@ -1707,15 +1708,15 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1707
1708
Status : "available" ,
1708
1709
TagSet : []ec2types.Tag {
1709
1710
{
1710
- Key : aws .String ("node.k8s.amazonaws.com/instance_id" ),
1711
+ Key : aws .String (eniNodeTagKey ),
1711
1712
Value : aws .String ("i-xxxxx" ),
1712
1713
},
1713
1714
{
1714
- Key : aws .String ("node.k8s.amazonaws.com/createdAt" ),
1715
+ Key : aws .String (eniCreatedAtTagKey ),
1715
1716
Value : aws .String (tenMinuteAgo .Format (time .RFC3339 )),
1716
1717
},
1717
1718
{
1718
- Key : aws .String ("cluster.k8s.amazonaws.com/name" ),
1719
+ Key : aws .String (eniClusterTagKey ),
1719
1720
Value : aws .String ("awesome-cluster" ),
1720
1721
},
1721
1722
},
@@ -1738,7 +1739,7 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1738
1739
Filters : []ec2types.Filter {
1739
1740
{
1740
1741
Name : aws .String ("tag-key" ),
1741
- Values : []string {"node.k8s.amazonaws.com/instance_id" },
1742
+ Values : []string {eniNodeTagKey },
1742
1743
},
1743
1744
{
1744
1745
Name : aws .String ("status" ),
@@ -1764,15 +1765,15 @@ func TestEC2InstanceMetadataCache_getLeakedENIs(t *testing.T) {
1764
1765
Status : "available" ,
1765
1766
TagSet : []ec2types.Tag {
1766
1767
{
1767
- Key : aws .String ("node.k8s.amazonaws.com/instance_id" ),
1768
+ Key : aws .String (eniNodeTagKey ),
1768
1769
Value : aws .String ("i-xxxxx" ),
1769
1770
},
1770
1771
{
1771
- Key : aws .String ("node.k8s.amazonaws.com/createdAt" ),
1772
+ Key : aws .String (eniCreatedAtTagKey ),
1772
1773
Value : aws .String (now .Format (time .RFC3339 )),
1773
1774
},
1774
1775
{
1775
- Key : aws .String ("cluster.k8s.amazonaws.com/name" ),
1776
+ Key : aws .String (eniClusterTagKey ),
1776
1777
Value : aws .String ("awesome-cluster" ),
1777
1778
},
1778
1779
},
@@ -1852,11 +1853,15 @@ func TestEC2InstanceMetadataCache_TagENI(t *testing.T) {
1852
1853
Resources : []string {"eni-xxxx" },
1853
1854
Tags : []ec2types.Tag {
1854
1855
{
1855
- Key : aws .String ("cluster.k8s.amazonaws.com/name" ),
1856
+ Key : aws .String (eniClusterTagKey ),
1856
1857
Value : aws .String ("awesome-cluster" ),
1857
1858
},
1858
1859
{
1859
- Key : aws .String ("node.k8s.amazonaws.com/instance_id" ),
1860
+ Key : aws .String (eniOwnerTagKey ),
1861
+ Value : aws .String (eniOwnerTagValue ),
1862
+ },
1863
+ {
1864
+ Key : aws .String (eniNodeTagKey ),
1860
1865
Value : aws .String ("i-xxxx" ),
1861
1866
},
1862
1867
},
@@ -1880,8 +1885,9 @@ func TestEC2InstanceMetadataCache_TagENI(t *testing.T) {
1880
1885
args : args {
1881
1886
eniID : "eni-xxxx" ,
1882
1887
currentTags : map [string ]string {
1883
- "node.k8s.amazonaws.com/instance_id" : "i-xxxx" ,
1884
- "cluster.k8s.amazonaws.com/name" : "awesome-cluster" ,
1888
+ eniNodeTagKey : "i-xxxx" ,
1889
+ eniClusterTagKey : "awesome-cluster" ,
1890
+ eniOwnerTagKey : eniOwnerTagValue ,
1885
1891
},
1886
1892
},
1887
1893
wantErr : nil ,
@@ -1897,9 +1903,13 @@ func TestEC2InstanceMetadataCache_TagENI(t *testing.T) {
1897
1903
Resources : []string {"eni-xxxx" },
1898
1904
Tags : []ec2types.Tag {
1899
1905
{
1900
- Key : aws .String ("cluster.k8s.amazonaws.com/name" ),
1906
+ Key : aws .String (eniClusterTagKey ),
1901
1907
Value : aws .String ("awesome-cluster" ),
1902
1908
},
1909
+ {
1910
+ Key : aws .String (eniOwnerTagKey ),
1911
+ Value : aws .String (eniOwnerTagValue ),
1912
+ },
1903
1913
},
1904
1914
},
1905
1915
},
@@ -1908,8 +1918,8 @@ func TestEC2InstanceMetadataCache_TagENI(t *testing.T) {
1908
1918
args : args {
1909
1919
eniID : "eni-xxxx" ,
1910
1920
currentTags : map [string ]string {
1911
- "node.k8s.amazonaws.com/instance_id" : "i-xxxx" ,
1912
- "anotherKey" : "anotherDay" ,
1921
+ eniNodeTagKey : "i-xxxx" ,
1922
+ "anotherKey" : "anotherDay" ,
1913
1923
},
1914
1924
},
1915
1925
wantErr : nil ,
@@ -1925,11 +1935,15 @@ func TestEC2InstanceMetadataCache_TagENI(t *testing.T) {
1925
1935
Resources : []string {"eni-xxxx" },
1926
1936
Tags : []ec2types.Tag {
1927
1937
{
1928
- Key : aws .String ("cluster.k8s.amazonaws.com/name" ),
1938
+ Key : aws .String (eniClusterTagKey ),
1929
1939
Value : aws .String ("awesome-cluster" ),
1930
1940
},
1931
1941
{
1932
- Key : aws .String ("node.k8s.amazonaws.com/instance_id" ),
1942
+ Key : aws .String (eniOwnerTagKey ),
1943
+ Value : aws .String (eniOwnerTagValue ),
1944
+ },
1945
+ {
1946
+ Key : aws .String (eniNodeTagKey ),
1933
1947
Value : aws .String ("i-xxxx" ),
1934
1948
},
1935
1949
},
0 commit comments