Skip to content

fix(vm): propagate PV nodeAffinity to VM pod for correct scheduling#2127

Open
loktev-d wants to merge 8 commits intofeat/vm/hotplug-block-devices-via-specfrom
fix/vm/pv-node-affinity-scheduling
Open

fix(vm): propagate PV nodeAffinity to VM pod for correct scheduling#2127
loktev-d wants to merge 8 commits intofeat/vm/hotplug-block-devices-via-specfrom
fix/vm/pv-node-affinity-scheduling

Conversation

@loktev-d
Copy link
Copy Markdown
Contributor

@loktev-d loktev-d commented Mar 23, 2026

Description

Propagate PV nodeAffinity to the VM pod so the Kubernetes scheduler respects disk topology constraints when placing VMs.

  • PVNodeAffinityTerms in VM state: collects nodeAffinity from PVs backing all block devices (spec refs + attached VMBDAs). Computes the intersection across PVs using cross-product of NodeSelectorTerms.
  • ApplyPVNodeAffinity in KVVM builder: merges PV node selector terms into the KVVM pod template affinity, preserving existing VM/class affinity via cross-product.
  • nodeaffinity package CrossProductTerms/IntersectTerms logic.

Why do we need it, and what problem does it solve?

What is the expected result?

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: vm
type: fix
summary: propagate PV nodeAffinity to VM pod for correct scheduling

@loktev-d loktev-d marked this pull request as draft March 23, 2026 14:38
@loktev-d loktev-d force-pushed the fix/vm/pv-node-affinity-scheduling branch from 2507e6f to 0cb1e94 Compare March 23, 2026 17:44
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
This reverts commit 68a6fde.

Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
@loktev-d loktev-d force-pushed the fix/vm/pv-node-affinity-scheduling branch from 0cb1e94 to 4028c4c Compare March 23, 2026 17:44
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
@loktev-d loktev-d marked this pull request as ready for review March 24, 2026 09:43
@loktev-d loktev-d added this to the v1.6.2 milestone Mar 24, 2026
@nevermarine nevermarine modified the milestones: v1.6.2, v1.7.0 Mar 25, 2026
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.

2 participants