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

Enhance subnet selection #2714

Merged
merged 1 commit into from
Mar 15, 2024
Merged

Enhance subnet selection #2714

merged 1 commit into from
Mar 15, 2024

Conversation

jchen6585
Copy link
Contributor

@jchen6585 jchen6585 commented Dec 15, 2023

What type of PR is this?

feature

Which issue does this PR fix:
N/A

What does this PR do / Why do we need it:
IP exhaustion in IPv4 is a prevalent issue. This PR helps with this by creating ENIs using all subnets in the VPC with the correct tags.

If an issue # is not available please add repro steps and logs from IPAMD/CNI showing the issue:

Testing done on this change:

Integration

  • CNI: Passing
Screenshot 2024-03-01 at 11 43 18 AM
  • IPAMD: Passing
Screenshot 2023-12-14 at 2 42 01 PM
  • Custom Networking: Passing
Screenshot 2023-12-14 at 3 10 57 PM
  • IPv6: Passing
Screenshot 2023-12-15 at 12 17 10 PM
  • ENI Subnet Selection (New Suite): Passing
Screenshot 2024-03-13 at 4 10 02 PM

Upgrade/Downgrade

  • Upgrading and downgrading won't break aws-node pod
  • Older cni version can delete ENIs created from the newer version

Performance Test

  • 130 Pods
enhanced-subnet-selection-130
  • 730 pods
enhanced-subnet-selection-730
  • 5000 pods
enhanced-subnet-selection-5000

Will this PR introduce any new dependencies?:

Yes

Will this break upgrades or downgrades? Has updating a running cluster been tested?:

No, Yes

Does this change require updates to the CNI daemonset config files to work?:

No

Does this PR introduce any user-facing change?:

Yes

All subnets tagged with `kubernetes.io*` or `*cluster-name` will be considered for eni allocation.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jchen6585 jchen6585 requested a review from a team as a code owner December 15, 2023 22:13
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Show resolved Hide resolved
pkg/awsutils/awsutils.go Show resolved Hide resolved
pkg/awsutils/awsutils.go Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
test/integration/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@jdn5126 jdn5126 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good overall, just nits. Will do one more pass on the test code next

pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
charts/aws-vpc-cni/values.yaml Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
@jchen6585 jchen6585 force-pushed the subnet-selection branch 3 times, most recently from 5bc3fdd to ef5d3c3 Compare March 13, 2024 17:11
README.md Show resolved Hide resolved
pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
} else {
if cache.useSubnetDiscovery {
subnetResult, vpcErr := cache.getVpcSubnets()
if vpcErr != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe as a fast follow up lets restructure the code..

  1. Get subnet -> Either primary ENI, ENIConfig or pick a subnet
  2. Get SG -> Either primary ENI SG or ENIConfig SG
  3. Modify the "input" with the new subnet ID and SG ID
  4. Call tryCreateNetworkInterface

@jchen6585 jchen6585 force-pushed the subnet-selection branch 3 times, most recently from 6cb6e9b to 29fabc8 Compare March 14, 2024 17:59
Copy link
Contributor

@jayanthvn jayanthvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jchen6585 jchen6585 merged commit 58336b7 into aws:master Mar 15, 2024
6 checks passed
[]string{createdSubnet},
[]*ec2.Tag{
{
Key: aws.String("kubernetes.io/role/cn"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubernetes.io/role/cniinstead of cn?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, it is alright. The tagging and un-tagging was consistent in this test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants