Skip to content

feat(nodeadm): support custom max pods expressions#2446

Merged
mselim00 merged 3 commits intoawslabs:mainfrom
mselim00:max-pods
Oct 3, 2025
Merged

feat(nodeadm): support custom max pods expressions#2446
mselim00 merged 3 commits intoawslabs:mainfrom
mselim00:max-pods

Conversation

@mselim00
Copy link
Copy Markdown
Contributor

@mselim00 mselim00 commented Sep 26, 2025

Issue #, if available:
Fixes #2201
Resolves #2276
Closes #782
Closes #953
Fixes #1698
Closes #2045

Description of changes:

Adds a new kubelet configuration to the NodeConfig to allow insertion of a MaxPodsExpression which is evaluated using cel-go to an int32 for use in the final kubelet configuration. The behavior is largely unchanged if an expression is not set, including the lack of the use of the cel evaluator.

There are a few internal changes to how the maxPods value is calculated, but these are tested in all the relevant ways to ensure they do not become external. The most obvious of these changes is that the pre-computed value is split up into its constituent parts (# ENIs and # IPs) to be extracted from a JSON lines file and computed at runtime.

There's one included change in the default behavior, which is to calculate the standard max pods value on the default network card rather than for all network cards on the instance. This only impacts users using an instance type not in the pre-existing eni_max_pods.txt file or the new instance-info.jsonl as this calculation is only done as a fallback. This change is a fix to prior inconsistent behavior to better line up with the values in the file cache. Some more details in #2229, which is superseded by this PR.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Testing Done

See this guide for recommended testing for PRs. Some tests may not apply. Completing tests and providing additional validation steps are not required, but it is recommended and may reduce review time and time to merge.

@mselim00 mselim00 force-pushed the max-pods branch 7 times, most recently from 3e18a56 to 074c0bd Compare September 29, 2025 20:37
@mselim00
Copy link
Copy Markdown
Contributor Author

/ci

@github-actions
Copy link
Copy Markdown
Contributor

@mselim00 roger that! I've dispatched a workflow. 👍

@mselim00 mselim00 force-pushed the max-pods branch 3 times, most recently from 2ce2935 to 0c89741 Compare September 29, 2025 21:38
@github-actions
Copy link
Copy Markdown
Contributor

@mselim00 the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.28 / al2023success ✅success ✅
1.29 / al2023success ✅failure ❌
1.30 / al2023success ✅failure ❌
1.31 / al2023success ✅failure ❌
1.32 / al2023success ✅success ✅
1.33 / al2023success ✅failure ❌

@mselim00
Copy link
Copy Markdown
Contributor Author

/ci

@github-actions
Copy link
Copy Markdown
Contributor

@mselim00 roger that! I've dispatched a workflow. 👍

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 1, 2025

@mselim00 the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.28 / al2023success ✅failure ❌
1.29 / al2023success ✅success ✅
1.30 / al2023success ✅failure ❌
1.31 / al2023success ✅failure ❌
1.32 / al2023success ✅success ✅
1.33 / al2023success ✅failure ❌

@mselim00 mselim00 force-pushed the max-pods branch 2 times, most recently from 7e3bb0b to 66dfb8a Compare October 1, 2025 02:53
#!/usr/bin/env bash
set -o errexit
cd amazon-eks-ami/
make generate-instance-info
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

im glad we're owning this ourselves now, can you also remove nodeadm/internal/kubelet/eni-max-pods.txt and remove that cp from the workflow flow?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was planning to keep the VPC CNI generated one for this PR to utilize as sanity check in a test (computed value from instanceInfo = old val) and then clean it up in a follow up. if you're convinced it's consistent then I can do that cleanup now 😅

Copy link
Copy Markdown
Contributor

@ndbaker1 ndbaker1 Oct 1, 2025

Choose a reason for hiding this comment

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

i did a quick check, transforming the jsonl to txt with this to do a diff

jq -r '"\(.instanceType) \(.defaultMaxENIs * (.ipv4AddressesPerInterface - 1) + 2)"'

only to realize the diff i got was just the manually added entries from https://github.com/aws/amazon-vpc-cni-k8s/blob/a49107121e4c0337372dbe18d65f15d761973ebf/scripts/gen_vpc_ip_limits.go#L202-L374

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good catch, I added in those overrides to ensure consistent behavior. also temporarily added a test to do the same and removed it, along with eni-max-pods.txt in 2311f7e

@mselim00 mselim00 force-pushed the max-pods branch 2 times, most recently from 8923128 to f896e80 Compare October 1, 2025 03:38
Copy link
Copy Markdown
Contributor

@fletcherw fletcherw left a comment

Choose a reason for hiding this comment

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

looks good from my perspective, up to you if you want to get Nick's approval as well.

@mselim00
Copy link
Copy Markdown
Contributor Author

mselim00 commented Oct 2, 2025

hopefully the CI's not still flaky

/ci

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 2, 2025

@mselim00 roger that! I've dispatched a workflow. 👍

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 2, 2025

@mselim00 the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.28 / al2023success ✅success ✅
1.29 / al2023success ✅success ✅
1.30 / al2023success ✅success ✅
1.31 / al2023success ✅success ✅
1.32 / al2023success ✅success ✅
1.33 / al2023success ✅success ✅

Copy link
Copy Markdown
Contributor

@shvbsle shvbsle left a comment

Choose a reason for hiding this comment

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

LGTM

@mselim00 mselim00 force-pushed the max-pods branch 3 times, most recently from 568f76d to c8d576d Compare October 3, 2025 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants