[FEATURE POC] Add support for EC2 active vCPU options#178
[FEATURE POC] Add support for EC2 active vCPU options#178davivcgarcia wants to merge 2 commits intoopenshift:mainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (2)
WalkthroughThis change adds support for propagating CPU options (CoreCount and ThreadsPerCore) from AWSMachineProviderConfig into EC2 CpuOptionsRequest. Corresponding test cases are added to cover the new functionality. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @davivcgarcia. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
I've found out that OpenShift currently offers the possibility to disable SMT, via MachineConfig or via PerformanceProfile. These mechanisms are based on changing Kernel arguments, so it disable SMT at operating system level. This PR and my proposal is about bringing the option to do the same at AWS hypervisor (Nitro) level. |
Summary
Hey folks! 👋
This PR extends
AWSMachineProviderConfig.CPUOptionsto expose EC2 Active vCPU controls — specificallycoreCountandthreadsPerCore— allowing OpenShift admins to fine-tune CPU topology when launching instances.These map directly to the
CpuOptionsRequestfields in the EC2RunInstancesAPI and give users control over Simultaneous Multithreading (SMT).Why this matters for OpenShift on EC2
Controlling SMT at the instance level is valuable for several real-world scenarios:
Performance-sensitive workloads: Some HPC, ML training, and latency-critical applications perform better with SMT disabled (
threadsPerCore: 1), as it eliminates thread contention on shared core resources. This is especially relevant for compute-optimized instance types likec5,c6i, andhpc6a.Licensing optimization: Many commercial software licenses (e.g., Oracle, SQL Server) are priced per-vCPU. Disabling hyperthreading cuts the visible vCPU count in half, directly reducing licensing costs while retaining the same number of physical cores.
Security and isolation: Disabling SMT mitigates certain side-channel attacks (e.g., MDS, L1TF) that exploit shared resources between hardware threads. This is particularly relevant for clusters handling sensitive data or running in regulated environments.
Right-sizing capacity: Specifying
coreCountallows launching an instance type with fewer active cores than the default, enabling cost savings when workloads don't need the full compute capacity of the chosen instance family.AWS documentation references
Example usage
What changed
coreCount(*int64, min 1) andthreadsPerCore(*int64, enum 1 or 2) to the existingCPUOptionsstruct, plus deepcopy and swagger doc updates.getCPUOptionsRequest()ininstances.goto pass the new fields through toec2.CpuOptionsRequest.CPUOptionsfields combined. All existing tests continue to pass.Both fields are optional and default to
nil(no opinion), so this is fully backward-compatible — existingMachinespecs are unaffected.Note
This is not a production-grade PR. It was co-built using Agentic Coding (with Claude Code) as a proof-of-concept to explore how AI-assisted development works for extending Kubernetes operators. The vendored API type changes would normally originate from the openshift/api repository first.
Test plan
go vet ./pkg/... ./cmd/...passesgo build ./cmd/...compiles-race(go test ./pkg/... ./cmd/...)TestGetCPUOptionsRequestcases all passSummary by CodeRabbit
Release Notes
New Features
Tests