Skip to content

feat: Add VMSizeProperties support to disable SMT/hyperthreading (rebase of #1419)#1746

Open
fabioaraujopt wants to merge 1 commit into
Azure:mainfrom
fabioaraujopt:feat/pr1419-refactor-plan
Open

feat: Add VMSizeProperties support to disable SMT/hyperthreading (rebase of #1419)#1746
fabioaraujopt wants to merge 1 commit into
Azure:mainfrom
fabioaraujopt:feat/pr1419-refactor-plan

Conversation

@fabioaraujopt

Copy link
Copy Markdown

Fixes #1541
Supersedes #1419

Summary

  • Rebased the SMT/hyperthreading control change onto latest main and aligned it with current provider structure.
  • Add vmSizeProperties.vCPUsPerCore to both v1beta1 and v1alpha2 AKSNodeClassSpec, with validation and regenerated CRD/deepcopy artifacts.
  • Apply VMSizeProperties only in VM API (aksscriptless) path; explicitly ignore it for AKS Machine API modes (aksmachineapi, aksmachineapiheaderbatch) with test coverage.

Test plan

  • go test ./pkg/providers/instance -run TestConvertVMSizeProperties -count=1
  • go test ./pkg/apis/v1beta1 -run TestAPIs -count=1 -args -ginkgo.focus=VMSizeProperties (with envtest assets)
  • go test ./pkg/apis/v1alpha2 -run TestAPIs -count=1 -args -ginkgo.focus=VMSizeProperties (with envtest assets)
  • go test ./pkg/apis/v1alpha2 ./pkg/apis/v1beta1 -run '^$' -count=1

Notes

This PR adds support for Azure VM vCore Customization feature,
allowing users to disable SMT (Simultaneous Multi-Threading, also
known as hyperthreading) on AKS nodes provisioned by Karpenter.

Changes:
- Add VMSizeProperties field to AKSNodeClassSpec API
- Support vCPUsPerCore configuration (1=SMT disabled, 2=SMT enabled)
- Add validation for vCPUsPerCore range (1-2)
- Update VM creation to apply vmSizeProperties to hardwareProfile
- Add comprehensive unit tests for API validation
- Add tests for VM creation with vmSizeProperties
- Generate updated CRDs with new field

Use case:
This feature is particularly useful for:
- CAE (Computer-Aided Engineering) workloads requiring consistent
  performance without SMT overhead
- Security hardening by disabling SMT to mitigate certain CPU
  vulnerabilities
- Workloads that benefit from dedicated physical cores

Example usage:
```yaml
apiVersion: karpenter.azure.com/v1beta1
kind: AKSNodeClass
metadata:
  name: smt-disabled
spec:
  imageFamily: AzureLinux
  vmSizeProperties:
    vCPUsPerCore: 1  # Disables SMT
```

Requirements:
- VM must support hyperthreading (2 threads per core)
- Can only be set at VM creation time
- Requires Azure API version 2021-07-01 or later

Related documentation:
https://learn.microsoft.com/en-us/azure/virtual-machines/vm-customization

Fixes: Feature request for SMT control in Azure Karpenter
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.

Feature: Add SMT/hyperthreading control for AKSNodeClass via VMSizeProperties

1 participant