Skip to content

fix(builder): key GPU interface node selector by interface, not memory size#412

Open
neyy91 wants to merge 1 commit into
akash-network:mainfrom
neyy91:fix/gpu-interface-selector
Open

fix(builder): key GPU interface node selector by interface, not memory size#412
neyy91 wants to merge 1 commit into
akash-network:mainfrom
neyy91:fix/gpu-interface-selector

Conversation

@neyy91

@neyy91 neyy91 commented Jun 22, 2026

Copy link
Copy Markdown

What

The GPU interface node-selector requirement in cluster/kube/builder/workload.go was built with gpu.MemorySize in the label key instead of gpu.Interface:

if gpu.Interface != "" {
    Key: fmt.Sprintf("%s.interface.%s", key, gpu.MemorySize) // -> gpu.Interface
}

Why

The inventory operator publishes the node label as <gpu>.interface.<interface> (operator/inventory/node-discovery.go, via info.Interface). Because the builder keyed the selector off the memory size instead, a workload requesting a specific GPU interface (e.g. pcie) produced a node-affinity requirement that can never match a real node label — so the pod fails to schedule.

Testing

Added Test_nodeSelectorsFromResources_GPUInterface: a GPU with memory_size=80Gi, interface=pcie must yield a selector keyed ...interface.pcie, and must NOT yield ...interface.80Gi. Fails before the fix

…y size

The interface node-selector requirement was built with gpu.MemorySize in
the label key instead of gpu.Interface. The inventory operator publishes
the node label as "<gpu>.interface.<interface>", so a workload requesting
a specific GPU interface produced a selector that could never match and
the pod would fail to schedule.
@neyy91 neyy91 requested a review from a team as a code owner June 22, 2026 18:22
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5efad696-6370-4394-b98a-5086760f69c1

📥 Commits

Reviewing files that changed from the base of the PR and between 0e0fd8a and 9046d42.

📒 Files selected for processing (2)
  • cluster/kube/builder/workload.go
  • cluster/kube/builder/workload_gpu_selector_test.go

Walkthrough

A one-line bug fix in cluster/kube/builder/workload.go corrects the GPU node selector key for the interface capability, substituting gpu.Interface for the previously used gpu.MemorySize. A new test in workload_gpu_selector_test.go verifies the corrected selector key is generated and the wrong key is absent.

Changes

GPU Interface Node Selector Fix

Layer / File(s) Summary
GPU interface selector fix and regression test
cluster/kube/builder/workload.go, cluster/kube/builder/workload_gpu_selector_test.go
nodeSelectorsFromResources now embeds gpu.Interface (not gpu.MemorySize) in the interface selector key; Test_nodeSelectorsFromResources_GPUInterface asserts the correct key is present and the memory-size-keyed interface key is absent.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A bunny once hopped through the selector maze,
Where memory-size wore an interface's face.
One line set it right, swapped the key with a hop,
Now interface selects what the GPU should top.
🐇 No more wrong keys — the scheduler's at peace!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: correcting GPU interface node selector to use interface value instead of memory size.
Description check ✅ Passed The description clearly explains the bug, its impact on pod scheduling, and provides context about why the fix was needed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant