hypervisor/kubevirt: implement CPU pinning for HV=k (KubeVirt)#5676
Open
zedi-pramodh wants to merge 1 commit intolf-edge:masterfrom
Open
hypervisor/kubevirt: implement CPU pinning for HV=k (KubeVirt)#5676zedi-pramodh wants to merge 1 commit intolf-edge:masterfrom
zedi-pramodh wants to merge 1 commit intolf-edge:masterfrom
Conversation
When CPUsPinned is set on a domain config, the KubeVirt VMI spec now: - Sets DedicatedCPUPlacement=true so the KubeVirt CPU Manager pins each vCPU to a unique physical CPU thread - Sets CPU Requests==Limits and Memory Requests==Limits in the VMI domain resources to achieve Kubernetes Guaranteed QoS, which is required by the kubelet static CPU Manager policy to honour dedicated CPU placement Additional changes to complete CPU pinning support for HV=k (KubeVirt): 1. pkg/kube/kubevirt-features.yaml Add CPUManager to the KubeVirt CR featureGates list so KubeVirt's CPU Manager integration is activated on fresh installs. 2. pkg/kube/kubevirt-utils.sh Update Kubevirt_migrate_feature_gates() to detect and patch in the CPUManager gate on upgrade from older EVE images. The sentinel check is updated from VideoConfig to CPUManager (the newest required gate) so the patch runs once on any image that lacks it. 3. pkg/kube/config.yaml Add cpu-manager-policy=static and cpu-manager-reconcile-period=5s to the k3s kubelet-arg list. The static policy is required by Kubernetes for exclusive (pinned) CPU allocation: pods must be in Guaranteed QoS (Requests == Limits) and the kubelet will then assign dedicated pCPUs. The reconcile period keeps the CPU Manager state in sync quickly. 4. Refactor the code in Kubevirt VM start where it is leading to infinite loop in case of error in ReplicaSet creation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Pramodh Pallapothu <pramodh@zededa.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
@zedi-pramodh , LGTM, just minor things:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When CPUsPinned is set on a domain config, the KubeVirt VMI spec now:
Additional changes to complete CPU pinning support for HV=k (KubeVirt):
pkg/kube/kubevirt-features.yaml Add CPUManager to the KubeVirt CR featureGates list so KubeVirt's CPU Manager integration is activated on fresh installs.
pkg/kube/kubevirt-utils.sh Update Kubevirt_migrate_feature_gates() to detect and patch in the CPUManager gate on upgrade from older EVE images. The sentinel check is updated from VideoConfig to CPUManager (the newest required gate) so the patch runs once on any image that lacks it.
pkg/kube/config.yaml Add cpu-manager-policy=static and cpu-manager-reconcile-period=5s to the k3s kubelet-arg list. The static policy is required by Kubernetes for exclusive (pinned) CPU allocation: pods must be in Guaranteed QoS (Requests == Limits) and the kubelet will then assign dedicated pCPUs. The reconcile period keeps the CPU Manager state in sync quickly.
Refactor the code in Kubevirt VM start where it is leading to infinite loop in case of error in ReplicaSet creation.
How to test and validate this PR
Changelog notes
CPU Pinning support for eve-k VMs
Checklist
And the last but not least:
check them.
Please, check the boxes above after submitting the PR in interactive mode.