Skip to content
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

Merge master to release-1.18 #3049

Merged
merged 86 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
ca74a14
Mount /run/xtables.lock as FileOrCreate (#2841)
kwohlfahrt Apr 3, 2024
d40f4a1
Bump github.com/onsi/ginkgo/v2 from 2.14.0 to 2.17.1 (#2864)
dependabot[bot] Apr 3, 2024
e111bea
Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#2863)
dependabot[bot] Apr 3, 2024
bccdbf7
Bump github.com/prometheus/common from 0.48.0 to 0.52.2 (#2866)
dependabot[bot] Apr 3, 2024
2694202
Bump helm.sh/helm/v3 from 3.14.2 to 3.14.3 (#2862)
dependabot[bot] Apr 3, 2024
e5f6998
Bump golang.org/x/sys from 0.17.0 to 0.18.0 in /test/agent (#2859)
dependabot[bot] Apr 3, 2024
389f5eb
Bump github.com/containernetworking/plugins from 1.4.0 to 1.4.1 (#2860)
dependabot[bot] Apr 3, 2024
883c3b2
remove unused Dockerfile (#2869)
sushrk Apr 8, 2024
fbad965
Update Kops test for 1.30 (#2868)
jchen6585 Apr 8, 2024
244f636
Update .go-version to 1.22.2 to fix CVE reports. (#2870)
orsenthil Apr 9, 2024
deaca4b
CHANGELOG, chart, and manifest changes following VPC CNI v1.18.0 rele…
jchen6585 Apr 16, 2024
cd7eb59
Update changelogs and charts for v1.18.0 release (#2858) (#2881)
jchen6585 Apr 17, 2024
19d59c1
Improve "cni-metrics-helper" setup experience (#2874)
guessi Apr 19, 2024
1a76401
Add correct labels to CNI metrics chart. (#2889)
orsenthil Apr 19, 2024
126a0ba
Added information on the build troubleshooting. (#2890)
orsenthil Apr 19, 2024
73c45d8
Remove unused code in vpc cni init and vpc cni binary. (#2891)
orsenthil Apr 20, 2024
92977ef
Bump golang.org/x/sys from 0.18.0 to 0.19.0 in /test/agent (#2898)
dependabot[bot] May 1, 2024
06828ce
Filter Managed ENI. (#2895)
orsenthil May 7, 2024
9ed4e3e
Merge release-1.18 to master after v1.18.1 release (#2914)
jchen6585 May 14, 2024
239ad1d
Update .go-version to fix GO-2024-2824 (#2911)
orsenthil May 17, 2024
05e7766
Soak Test for CNI. (#2915)
orsenthil May 18, 2024
3daa258
Bump github.com/aws/amazon-vpc-resource-controller-k8s (#2910)
dependabot[bot] May 18, 2024
4c1b162
Update ENI Limits. (#2920)
orsenthil May 20, 2024
7eb07e9
Skip Soak Test while running other tests. (#2922)
orsenthil May 21, 2024
5d0e6e2
Update golang to go1.22.3 (#2924)
orsenthil May 23, 2024
5fb5020
Bump k8s.io/api from 0.29.3 to 0.30.1 (#2918)
dependabot[bot] May 23, 2024
d0590be
Switch to counter for awscni_no_available_ip_addresses (#2919)
liptanbiswas May 25, 2024
a477f12
Expose network policy log file location to be configured using helm (…
orsenthil May 28, 2024
1b9fe03
Merge release branch release_1.18 (#2929)
orsenthil May 28, 2024
c8a2944
Helpful Make target to login to public ECR. (#2934)
orsenthil May 29, 2024
bf26956
Skip Static Canary in run-integration-test in Github. (#2935)
orsenthil May 30, 2024
3e28975
Run Kops Test Separately to triage failures. (#2936)
orsenthil Jun 1, 2024
a9aaec7
Bump go.uber.org/zap from 1.26.0 to 1.27.0 (#2938)
dependabot[bot] Jun 3, 2024
f9aa080
Bump golang.org/x/sys from 0.19.0 to 0.20.0 in /test/agent (#2937)
dependabot[bot] Jun 3, 2024
8f9253e
Merge Changes from release-1.18 to master (#2944)
orsenthil Jun 4, 2024
83b8704
Update .go-version to 1.22.4 (#2950)
orsenthil Jun 12, 2024
9fdcb5f
disable leaked eni cleanup routine when vpc-resource-controller is de…
sushrk Jun 13, 2024
1829b87
Bump github.com/containernetworking/cni from 1.1.2 to 1.2.0 (#2901)
dependabot[bot] Jun 14, 2024
71263b9
Update test options default value and help. (#2955)
orsenthil Jun 14, 2024
86f2c72
Bump sigs.k8s.io/controller-runtime from 0.17.0 to 0.18.4 (#2962)
dependabot[bot] Jun 19, 2024
4dc206e
Bump k8s.io/cli-runtime from 0.29.0 to 0.30.2 (#2965)
dependabot[bot] Jun 19, 2024
f716a1d
Bump helm.sh/helm/v3 from 3.14.3 to 3.15.2 (#2964)
dependabot[bot] Jun 19, 2024
0e3d4b1
[cni-metrics-helper] Expose container port when enabling prometheus m…
toVersus Jun 21, 2024
7619bdb
Subnet Discovery - Unfilled ENI fix (#2954)
jchen6585 Jun 21, 2024
fb171f3
Refactor static canary tests. (#2966)
orsenthil Jun 22, 2024
189f00f
Upgrade to latest versions of GitHub actions (#2952)
electrocucaracha Jun 24, 2024
89d9112
Update the APISpec Schema definition for ENIConfig. (#2969)
orsenthil Jun 26, 2024
77bdd31
Use ECR Mirror for Curl Test Image. (#2956)
orsenthil Jun 28, 2024
fe4c7a1
misc/10-aws.conflist: use __MTU__ variable for IPv4 egress-cni too (#…
benben Jul 1, 2024
a79c68c
Bump github.com/aws/aws-sdk-go from 1.51.32 to 1.54.11 (#2976)
dependabot[bot] Jul 1, 2024
5b8ce0b
Bump github.com/go-logr/logr from 1.4.1 to 1.4.2 (#2975)
dependabot[bot] Jul 1, 2024
8b3f05a
Bump github.com/prometheus/client_golang from 1.19.0 to 1.19.1 (#2972)
dependabot[bot] Jul 1, 2024
394afef
Bump golang.org/x/sys from 0.20.0 to 0.21.0 in /test/agent (#2977)
dependabot[bot] Jul 1, 2024
b0ef946
Bump github.com/containernetworking/plugins from 1.4.1 to 1.5.1 (#2974)
dependabot[bot] Jul 3, 2024
fb6b579
Add unit test and readme update for POD_MTU/ AWS_VPC_ENI_MTU for Egre…
orsenthil Jul 4, 2024
d056b83
Update .go-version (#2981)
orsenthil Jul 10, 2024
19ec2d2
Add extraEnv for add additional env from configmap or secrets to daem…
gawsoftpl Jul 10, 2024
110c30d
bpr: fix templating bug on helm when cniconfig is enabled (#2983)
FatPudgeB93 Jul 10, 2024
2e00de5
Update vpc_ip_resource_limit.go link in README.md (#2986)
kimsehwan96 Jul 17, 2024
e8faf2f
Revert "disable leaked eni cleanup routine when vpc-resource-controll…
orsenthil Jul 17, 2024
2884e90
updating iam doc with subnet policy (#2992)
yash97 Jul 23, 2024
6fc1be6
Bump github.com/docker/docker (#2996)
dependabot[bot] Jul 30, 2024
7b9c37b
Bump golang.org/x/sys from 0.21.0 to 0.22.0 in /test/agent (#3005)
dependabot[bot] Aug 1, 2024
dbea58a
Bump github.com/onsi/gomega from 1.33.1 to 1.34.1 (#3002)
dependabot[bot] Aug 1, 2024
73adb4c
Document the Multi Card Support Limitation. (#3006)
orsenthil Aug 2, 2024
7236559
Bump github.com/aws/aws-sdk-go from 1.54.11 to 1.55.5 (#3000)
dependabot[bot] Aug 2, 2024
abc9cfb
Bump github.com/onsi/ginkgo/v2 from 2.19.0 to 2.19.1 (#3001)
dependabot[bot] Aug 2, 2024
01a81d9
Bump k8s.io/client-go from 0.30.2 to 0.30.3 (#3003)
dependabot[bot] Aug 3, 2024
1818159
Bump github.com/containernetworking/cni from 1.2.0 to 1.2.3 (#3004)
dependabot[bot] Aug 3, 2024
a473163
fix: init.image.pullPolicy and nodeAgent.image.pullPolicy not being r…
zyue110026 Aug 8, 2024
443f530
Bump github.com/docker/docker (#3011)
dependabot[bot] Aug 9, 2024
27ce136
Update kops version and k8s version (#3012)
zachdorame Aug 9, 2024
5c471fe
Bug fix: Ensure exact IP match between IMDS and local datastore. (#3033)
yash97 Sep 18, 2024
4d1442a
Bump golang.org/x/sys from 0.22.0 to 0.24.0 in /test/agent (#3027)
dependabot[bot] Sep 23, 2024
fe812f5
Bump github.com/coreos/go-iptables from 0.7.0 to 0.8.0 in /test/agent…
dependabot[bot] Sep 23, 2024
8d6b674
Bump github.com/vishvananda/netlink from 1.1.0 to 1.3.0 in /test/agen…
dependabot[bot] Sep 24, 2024
eaa5db8
Bump github.com/prometheus/client_model from 0.6.0 to 0.6.1 (#3024)
dependabot[bot] Sep 24, 2024
49b0742
Bump github.com/coreos/go-iptables from 0.7.0 to 0.8.0 (#3020)
dependabot[bot] Sep 24, 2024
abaf575
Bump golang.org/x/sys from 0.22.0 to 0.25.0 (#3037)
dependabot[bot] Sep 24, 2024
eb7a9bd
Fix fetching enimetadata (#3035)
Pavani-Panakanti Sep 25, 2024
262e4a7
Changelog, Chart Versions and Config Version update for CNI Release v…
jaydeokar Sep 25, 2024
aa9c596
Bump google.golang.org/protobuf from 1.34.1 to 1.34.2 (#3023)
dependabot[bot] Sep 25, 2024
3fae323
Revert "Fix fetching enimetadata (#3035)" (#3042)
jaydeokar Sep 26, 2024
226a61d
Revert test script changes in canary and integration test (#3045)
jaydeokar Sep 26, 2024
a35a112
Filter for interfaces with no ip info (#3047)
Pavani-Panakanti Sep 27, 2024
5d973f7
merge master to release-1.18
Pavani-Panakanti Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion pkg/awsutils/awsutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,53 @@ func (cache *EC2InstanceMetadataCache) getENIMetadata(eniMAC string) (ENIMetadat

log.Debugf("Found ENI: %s, MAC %s, device %d", eniID, eniMAC, deviceNum)

// Get IMDS fields for the interface
macImdsFields, err := cache.imds.GetMACImdsFields(ctx, eniMAC)
if err != nil {
awsAPIErrInc("GetMACImdsFields", err)
return ENIMetadata{}, err
}
ipInfoAvailable := false
// Efa-only interfaces do not have any ipv4s or ipv6s associated with it. If we don't find any local-ipv4 or ipv6 info in imds we assume it to be efa-only interface and validate this later via ec2 call
for _, field := range macImdsFields {
if field == "local-ipv4s" {
imdsIPv4s, err := cache.imds.GetLocalIPv4s(ctx, eniMAC)
if err != nil {
awsAPIErrInc("GetLocalIPv4s", err)
return ENIMetadata{}, err
}
if len(imdsIPv4s) > 0 {
ipInfoAvailable = true
log.Debugf("Found IPv4 addresses associated with interface. This is not efa-only interface")
break
}
}
if field == "ipv6s" {
imdsIPv6s, err := cache.imds.GetIPv6s(ctx, eniMAC)
if err != nil {
awsAPIErrInc("GetIPv6s", err)
} else if len(imdsIPv6s) > 0 {
ipInfoAvailable = true
log.Debugf("Found IPv6 addresses associated with interface. This is not efa-only interface")
break
}
}
}

if !ipInfoAvailable {
return ENIMetadata{
ENIID: eniID,
MAC: eniMAC,
DeviceNumber: deviceNum,
SubnetIPv4CIDR: "",
IPv4Addresses: make([]*ec2.NetworkInterfacePrivateIpAddress, 0),
IPv4Prefixes: make([]*ec2.Ipv4PrefixSpecification, 0),
SubnetIPv6CIDR: "",
IPv6Addresses: make([]*ec2.NetworkInterfaceIpv6Address, 0),
IPv6Prefixes: make([]*ec2.Ipv6PrefixSpecification, 0),
}, nil
}

// Get IPv4 and IPv6 addresses assigned to interface
cidr, err := cache.imds.GetSubnetIPv4CIDRBlock(ctx, eniMAC)
if err != nil {
Expand Down Expand Up @@ -1356,9 +1403,16 @@ func (cache *EC2InstanceMetadataCache) DescribeAllENIs() (DescribeAllENIsResult,
if interfaceType == "trunk" {
trunkENI = eniID
}
if interfaceType == "efa" {
if interfaceType == "efa" || interfaceType == "efa-only" {
efaENIs[eniID] = true
}
if interfaceType != "efa-only" {
if len(eniMetadata.IPv4Addresses) == 0 {
log.Errorf("Missing IP addresses from IMDS. Non efa-only interface should have IP address associated with it %s", eniID)
outOfSyncErr := errors.New("DescribeAllENIs: No IPv4 address found")
return DescribeAllENIsResult{}, outOfSyncErr
}
}
// Check IPv4 addresses
logOutOfSyncState(eniID, eniMetadata.IPv4Addresses, ec2res.PrivateIpAddresses)
tagMap[eniMetadata.ENIID] = convertSDKTagsToTags(ec2res.TagSet)
Expand Down
59 changes: 42 additions & 17 deletions pkg/awsutils/awsutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,19 @@ const (
eni2ID = "eni-12341234"
metadataVPCIPv4CIDRs = "192.168.0.0/16 100.66.0.0/1"
myNodeName = "testNodeName"
imdsMACFields = "security-group-ids subnet-id vpc-id vpc-ipv4-cidr-blocks device-number interface-id subnet-ipv4-cidr-block local-ipv4s ipv4-prefix ipv6-prefix"
imdsMACFieldsEfaOnly = "security-group-ids subnet-id vpc-id vpc-ipv4-cidr-blocks device-number interface-id subnet-ipv4-cidr-block ipv4-prefix ipv6-prefix"
)

func testMetadata(overrides map[string]interface{}) FakeIMDS {
data := map[string]interface{}{
metadataAZ: az,
metadataLocalIP: localIP,
metadataInstanceID: instanceID,
metadataInstanceType: instanceType,
metadataMAC: primaryMAC,
metadataMACPath: primaryMAC,
metadataAZ: az,
metadataLocalIP: localIP,
metadataInstanceID: instanceID,
metadataInstanceType: instanceType,
metadataMAC: primaryMAC,
metadataMACPath: primaryMAC,
metadataMACPath + primaryMAC: imdsMACFields,
metadataMACPath + primaryMAC + metadataDeviceNum: eni1Device,
metadataMACPath + primaryMAC + metadataInterface: primaryeniID,
metadataMACPath + primaryMAC + metadataSGs: sgs,
Expand All @@ -109,12 +112,13 @@ func testMetadata(overrides map[string]interface{}) FakeIMDS {

func testMetadataWithPrefixes(overrides map[string]interface{}) FakeIMDS {
data := map[string]interface{}{
metadataAZ: az,
metadataLocalIP: localIP,
metadataInstanceID: instanceID,
metadataInstanceType: instanceType,
metadataMAC: primaryMAC,
metadataMACPath: primaryMAC,
metadataAZ: az,
metadataLocalIP: localIP,
metadataInstanceID: instanceID,
metadataInstanceType: instanceType,
metadataMAC: primaryMAC,
metadataMACPath: primaryMAC,
metadataMACPath + primaryMAC: imdsMACFields,
metadataMACPath + primaryMAC + metadataDeviceNum: eni1Device,
metadataMACPath + primaryMAC + metadataInterface: primaryeniID,
metadataMACPath + primaryMAC + metadataSGs: sgs,
Expand Down Expand Up @@ -203,7 +207,8 @@ func TestInitWithEC2metadataErr(t *testing.T) {

func TestGetAttachedENIs(t *testing.T) {
mockMetadata := testMetadata(map[string]interface{}{
metadataMACPath: primaryMAC + " " + eni2MAC,
metadataMACPath: primaryMAC + " " + eni2MAC,
metadataMACPath + eni2MAC: imdsMACFields,
metadataMACPath + eni2MAC + metadataDeviceNum: eni2Device,
metadataMACPath + eni2MAC + metadataInterface: eni2ID,
metadataMACPath + eni2MAC + metadataSubnetCIDR: subnetCIDR,
Expand All @@ -217,9 +222,26 @@ func TestGetAttachedENIs(t *testing.T) {
}
}

func TestGetAttachedENIsWithEfaOnly(t *testing.T) {
mockMetadata := testMetadata(map[string]interface{}{
metadataMACPath: primaryMAC + " " + eni2MAC,
metadataMACPath + eni2MAC: imdsMACFieldsEfaOnly,
metadataMACPath + eni2MAC + metadataDeviceNum: eni2Device,
metadataMACPath + eni2MAC + metadataInterface: eni2ID,
metadataMACPath + eni2MAC + metadataSubnetCIDR: subnetCIDR,
})

cache := &EC2InstanceMetadataCache{imds: TypedIMDS{mockMetadata}}
ens, err := cache.GetAttachedENIs()
if assert.NoError(t, err) {
assert.Equal(t, len(ens), 2)
}
}

func TestGetAttachedENIsWithPrefixes(t *testing.T) {
mockMetadata := testMetadata(map[string]interface{}{
metadataMACPath: primaryMAC + " " + eni2MAC,
metadataMACPath: primaryMAC + " " + eni2MAC,
metadataMACPath + eni2MAC: imdsMACFields,
metadataMACPath + eni2MAC + metadataDeviceNum: eni2Device,
metadataMACPath + eni2MAC + metadataInterface: eni2ID,
metadataMACPath + eni2MAC + metadataSubnetCIDR: subnetCIDR,
Expand Down Expand Up @@ -343,6 +365,7 @@ func TestDescribeAllENIs(t *testing.T) {
Attachment: &ec2.NetworkInterfaceAttachment{
NetworkCardIndex: aws.Int64(0),
},
NetworkInterfaceId: aws.String(primaryeniID),
}},
}

Expand All @@ -357,7 +380,7 @@ func TestDescribeAllENIs(t *testing.T) {
awsErr error
expErr error
}{
{"Success DescribeENI", map[string]TagMap{"": {"foo": "foo-value"}}, 1, nil, nil},
{"Success DescribeENI", map[string]TagMap{"eni-00000000": {"foo": "foo-value"}}, 1, nil, nil},
{"Not found error", nil, maxENIEC2APIRetries, awserr.New("InvalidNetworkInterfaceID.NotFound", "no 'eni-xxx'", nil), expectedError},
{"Not found, no message", nil, maxENIEC2APIRetries, awserr.New("InvalidNetworkInterfaceID.NotFound", "no message", nil), noMessageError},
{"Other error", nil, maxENIEC2APIRetries, err, err},
Expand Down Expand Up @@ -1006,7 +1029,8 @@ func TestEC2InstanceMetadataCache_waitForENIAndIPsAttached(t *testing.T) {
}
fmt.Println("eniips", eniIPs)
mockMetadata := testMetadata(map[string]interface{}{
metadataMACPath: primaryMAC + " " + eni2MAC,
metadataMACPath: primaryMAC + " " + eni2MAC,
metadataMACPath + eni2MAC: imdsMACFields,
metadataMACPath + eni2MAC + metadataDeviceNum: eni2Device,
metadataMACPath + eni2MAC + metadataInterface: eni2ID,
metadataMACPath + eni2MAC + metadataSubnetCIDR: subnetCIDR,
Expand Down Expand Up @@ -1101,7 +1125,8 @@ func TestEC2InstanceMetadataCache_waitForENIAndPrefixesAttached(t *testing.T) {
eniPrefixes = ""
}
mockMetadata := testMetadata(map[string]interface{}{
metadataMACPath: primaryMAC + " " + eni2MAC,
metadataMACPath: primaryMAC + " " + eni2MAC,
metadataMACPath + eni2MAC: imdsMACFields,
metadataMACPath + eni2MAC + metadataDeviceNum: eni2Device,
metadataMACPath + eni2MAC + metadataInterface: eni2ID,
metadataMACPath + eni2MAC + metadataSubnetCIDR: subnetCIDR,
Expand Down
18 changes: 18 additions & 0 deletions pkg/awsutils/imds.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,24 @@ func (imds TypedIMDS) GetMACs(ctx context.Context) ([]string, error) {
return list, err
}

// GetMACImdsFields returns the imds fields present for a MAC
func (imds TypedIMDS) GetMACImdsFields(ctx context.Context, mac string) ([]string, error) {
key := fmt.Sprintf("network/interfaces/macs/%s", mac)
list, err := imds.getList(ctx, key)
if err != nil {
if imdsErr, ok := err.(*imdsRequestError); ok {
log.Warnf("%v", err)
return nil, imdsErr.err
}
return nil, err
}
// Remove trailing /
for i, item := range list {
list[i] = strings.TrimSuffix(item, "/")
}
return list, err
}

// GetInterfaceID returns the ID of the network interface.
func (imds TypedIMDS) GetInterfaceID(ctx context.Context, mac string) (string, error) {
key := fmt.Sprintf("network/interfaces/macs/%s/interface-id", mac)
Expand Down
Loading