gpu-operator icon indicating copy to clipboard operation
gpu-operator copied to clipboard

[Feature]: Support affinity / nodeSelector for operand DaemonSets in ClusterPolicy spec.daemonsets

Open yalattas opened this issue 4 months ago • 3 comments

Feature description

Add affinity and nodeSelector to the common DaemonSet config in ClusterPolicy (spec.daemonsets), surfaced in the Helm chart as daemonsets.affinity / daemonsets.nodeSelector (default empty). When set, apply them to all operand DaemonSets (driver, container-toolkit, device-plugin, dcgm-exporter, gfd, mig-manager, …), on top of the operator's existing NFD-based node selection.

Motivation

spec.daemonsets already exposes tolerations but has no affinity/nodeSelector. That's an asymmetry: tolerations only permit scheduling onto tainted nodes — they can't restrict where operands land. On a cloud cluster (EKS/GKE/AKS) with several autoscaled node pools where only one has GPUs, I want to declaratively pin operands to that pool via a label it already carries (e.g. karpenter.sh/nodepool=gpu).

The documented alternatives don't cover this well:

  • nvidia.com/gpu.deploy.<operand>=disabled labels / node taints (how #547 was closed) are subtractive: you must label or taint every node you want to exclude. In autoscaled clusters (Karpenter, managed nodegroups) where nodes churn constantly, that doesn't scale and is race-prone.
  • NFD gating keeps operands off non-GPU nodes, but can't target a specific GPU pool and doesn't apply when NFD is disabled.

A first-class affinity/nodeSelector is declarative, applies automatically to new nodes, and is consistent with the operator's own NvidiaDriver CRD, which already exposes spec.affinity and spec.nodeSelector.

Prior art

#547 requested essentially this and was closed pointing at the subtractive workarounds above; a community MR to add nodeSelector to the common daemonset config was referenced there but never landed.

Proposed API

# ClusterPolicy
spec:
  daemonsets:
    nodeSelector:            # proposed
      karpenter.sh/nodepool: gpu
    affinity: {}             # proposed
# Helm values.yaml
daemonsets:
  affinity: {}       # default: unchanged behavior
  nodeSelector: {}   # default: unchanged behavior

User-supplied values should be merged (AND) with the operator's NFD-based selection so GPU detection still applies.

yalattas avatar Jul 12 '26 09:07 yalattas

Opened https://github.com/NVIDIA/gpu-operator/pull/2645. Adds spec.daemonsets.affinity and nodeSelector with Helm wiring; user nodeSelector labels merge with the existing deploy labels.

amarkdotdev avatar Jul 16 '26 16:07 amarkdotdev

This issue is stale because it has been open 90 days with no activity. This issue will be closed in 30 days unless new comments are made or the stale label is removed. To skip these checks, apply the "lifecycle/frozen" label.

github-actions[bot] avatar Oct 15 '26 04:10 github-actions[bot]

This issue was automatically closed due to inactivity.

github-actions[bot] avatar Nov 15 '26 04:11 github-actions[bot]