feat: Add networkPerformanceOptions support to EC2NodeClass#9089
feat: Add networkPerformanceOptions support to EC2NodeClass#9089knkarthik01 wants to merge 9 commits intoaws:mainfrom
Conversation
Add spec.networkPerformanceOptions.bandwidthWeighting to EC2NodeClass, enabling bandwidth weighting configuration (vpc-1, ebs-1) for 8th-gen EC2 instance types (M8, C8, R8, X8 families). When set, Karpenter includes NetworkPerformanceOptions in the generated launch template. This allows workloads using local NVMe (no EBS) to shift baseline bandwidth from EBS to networking at no additional cost. Currently there is no way to configure this in Karpenter since custom launch templates were removed in v0.33+ and the modify API requires stopped instances. Resolves aws#9088
|
Preview deployment ready! Preview URL: https://pr-9089.d18coufmbnnaag.amplifyapp.com Built from commit |
There was a problem hiding this comment.
Pull request overview
Adds support for configuring EC2 8th-gen instance bandwidth weighting by exposing spec.networkPerformanceOptions.bandwidthWeighting on EC2NodeClass and wiring it through to the generated EC2 Launch Template request.
Changes:
- Add
NetworkPerformanceOptionstoEC2NodeClassSpec(with enum validation forbandwidthWeighting). - Thread
NetworkPerformanceOptionsthrough AMI family resolver into launch template generation. - Add launch template provider tests to validate default behavior and explicit
vpc-1/ebs-1settings, plus LT name hash uniqueness.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/apis/v1/ec2nodeclass.go | Adds API field + type for networkPerformanceOptions with validation markers. |
| pkg/providers/amifamily/resolver.go | Includes NetworkPerformanceOptions in resolved launch template options. |
| pkg/providers/launchtemplate/types.go | Sets NetworkPerformanceOptions on RequestLaunchTemplateData when configured. |
| pkg/providers/launchtemplate/suite_test.go | Adds coverage for default + configured bandwidth weighting and LT name uniqueness. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| MetadataOptions *MetadataOptions `json:"metadataOptions,omitempty"` | ||
| // NetworkPerformanceOptions configure the network performance options for instances | ||
| // launched with this EC2NodeClass. Allows configuring bandwidth weighting between | ||
| // networking and EBS for supported 8th-gen instance types (M8, C8, R8, X8 families). |
There was a problem hiding this comment.
Resolved — CRDs regenerated and deepcopy methods added in subsequent commits.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Run controller-gen to update EC2NodeClass CRD with the new networkPerformanceOptions field and bandwidthWeighting enum.
Add DeepCopyInto/DeepCopy for NetworkPerformanceOptions type. Regenerate EC2NodeClass CRDs with controller-gen.
|
CI is failing on The 2 remaining diffs are:
The actual code changes (4 files) are correct and the tests pass when the CRD is properly registered. Could a maintainer run Alternatively, I can revert my generated files and just include the code changes — the CI |
|
CI update: 7/8 ci-test jobs pass. The single failure (1.30.x) is an unrelated flaky test: This is in Ready for review @DerekFrank. |
DerekFrank
left a comment
There was a problem hiding this comment.
Left a comment on the parent issue, this warrants a small design prior to PR review:
You can submit the design alongside the PR if you'd like, or stage them. Up to you
Addresses design questions from review: - Mixed fleet support (no instance type filtering) - Conditional launch template generation per instance type - Instance type discovery via DescribeInstanceTypes - NodeClass-level configuration (not pod-level) - Node labeling for observability and optional pod affinity - Drift detection
|
@DerekFrank Added a design doc: Key design decisions:
Happy to discuss at the next Working Group meeting. |
|
Feature itself is tightly scoped —
Nothing blocking — mostly want to make sure drift behavior is spelled out in the design doc before merge. |
Add validation and discovery details for bandwidth weighting support.
|
Pushed an update addressing the review points, main changes are explicit replacement-only drift with a distinct BandwidthWeightingDrift reason, a new Validation section covering the runtime guard for unknown enum values, a Discovery Misclassifications table + release note for the silent-ignore reliance, and clarified default-vs-unset semantics so existing NodeClasses don't churn on upgrade. Full doc: bandwidth-weighting-support.md. Heads up: I'm traveling next week, so the earliest WG I can join is the week of 5/4. Happy to keep this moving offline in the thread if that works for you all - otherwise no rush, we can address this during first week of May |
What
Adds
spec.networkPerformanceOptions.bandwidthWeightingto EC2NodeClass, enabling bandwidth weighting configuration (vpc-1,ebs-1) for 8th-gen EC2 instance types.Why
8th-gen instances (M8, C8, R8, X8 families) support configurable bandwidth weighting that shifts baseline bandwidth between networking and EBS. For workloads using local NVMe (no EBS),
vpc-1provides ~25% more network bandwidth at no cost.Currently there is no way to configure this in Karpenter:
networkPerformanceOptionsmodify-instance-network-performance-optionsAPI requires stopped instances, so userData won't workResolves #9088
How
Wires
NetworkPerformanceOptionsfrom EC2NodeClass spec through to the generated launch template. Same pattern asMetadataOptionsandDetailedMonitoring.Changes
pkg/apis/v1/ec2nodeclass.go— field + type definitionpkg/providers/amifamily/resolver.go— struct field + wiringpkg/providers/launchtemplate/types.go— LT data + helper functionpkg/providers/launchtemplate/suite_test.go— 3 tests + hash uniquenessTesting
vpc-1works at EC2 launch time on R8g instances ✓LaunchTemplateNetworkPerformanceOptionsRequesttype ✓Usage
Note
CRD regeneration (
make generate) may be needed — happy to add that as a follow-up commit once CI confirms.