Skip to content

fix(nvca): apply node affinity in miniservice mutating wh#368

Merged
estroz merged 1 commit into
mainfrom
estroczynski/fix/nvca-port-v3.0.12-webhook-node-affinity
Jul 23, 2026
Merged

fix(nvca): apply node affinity in miniservice mutating wh#368
estroz merged 1 commit into
mainfrom
estroczynski/fix/nvca-port-v3.0.12-webhook-node-affinity

Conversation

@estroz

@estroz estroz commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Fix node affinity bug

Additional Details (optional for docs, build, test, refactor, ci, chore, style, and revert PRs)

For the Reviewer

For QA (optional for docs, build, test, refactor, ci, chore, style, and revert PRs)

Issues

Closes #367

Checklist

  • I am familiar with the Contributing Guidelines.
  • I have signed off my commits for Developer Certificate of Origin (DCO) compliance.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • Bug Fixes

    • Prevented duplicate CPU workload scheduling preferences when pod affinity is applied repeatedly.
    • Improved node-affinity handling for CPU and GPU workloads, including instance-type constraints.
    • Ensured pod mutations remain consistent when multiple scheduling integrations are applied in different orders.
  • Tests

    • Added coverage for duplicate affinity prevention and combined webhook behavior.

Signed-off-by: Eric Stroczynski <estroczynski@nvidia.com>
@estroz
estroz requested a review from a team as a code owner July 23, 2026 00:00
@coderabbitai

coderabbitai Bot commented Jul 23, 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: Enterprise

Run ID: 3c909ab0-b22b-4a40-b1f7-dc059a0bf41d

📥 Commits

Reviewing files that changed from the base of the PR and between 7aad043 and 94205b6.

📒 Files selected for processing (4)
  • src/compute-plane-services/nvca/internal/util/k8sutil/affinity.go
  • src/compute-plane-services/nvca/internal/util/k8sutil/affinity_test.go
  • src/compute-plane-services/nvca/pkg/webhook/miniservice_mutating_webhook.go
  • src/compute-plane-services/nvca/pkg/webhook/miniservice_mutating_webhook_test.go

📝 Walkthrough

Walkthrough

The change deduplicates CPU soft anti-affinity terms and updates miniservice webhook mutation ordering and node-affinity handling. Tests cover repeated mutations, GPU and CPU affinity requirements, shared-cluster behavior, preset affinity, and interaction with the pod-affinity webhook.

Changes

Node affinity behavior

Layer / File(s) Summary
CPU affinity deduplication
src/compute-plane-services/nvca/internal/util/k8sutil/affinity.go, src/compute-plane-services/nvca/internal/util/k8sutil/affinity_test.go
Existing CPU soft anti-affinity preferences are detected before insertion, with coverage for repeated calls and multi-expression terms.
Webhook affinity flow
src/compute-plane-services/nvca/pkg/webhook/miniservice_mutating_webhook.go, src/compute-plane-services/nvca/pkg/webhook/miniservice_mutating_webhook_test.go
PodSpec mutation runs after NVLink DRA and shared-storage mutations; the alternate node-affinity branch applies instance-type affinity, with tests for GPU, CPU, shared-cluster, preset, ordering, and idempotency cases.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses valid Conventional Commits form and matches the bug fix to apply node affinity in the miniservice mutating webhook.
Linked Issues check ✅ Passed The code updates and tests address #367 by applying node affinity to workload pods and verifying the expected GPU-targeting behavior.
Out of Scope Changes check ✅ Passed The changes stay focused on node-affinity handling and supporting tests, with no clear unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch estroczynski/fix/nvca-port-v3.0.12-webhook-node-affinity

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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

@estroz
estroz enabled auto-merge July 23, 2026 00:03
@estroz
estroz added this pull request to the merge queue Jul 23, 2026
Merged via the queue into main with commit 830d6df Jul 23, 2026
13 checks passed
@estroz
estroz deleted the estroczynski/fix/nvca-port-v3.0.12-webhook-node-affinity branch July 23, 2026 00:43
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.

[nvca] node affinity not applied to workload pods

2 participants