Skip to content

helm: add nodeSelector to upgrade-crd hook Job to prevent Windows scheduling - #2640

Merged
rahulait merged 1 commit into
NVIDIA:mainfrom
iacker:fix/upgrade-crd-nodeselector
Jul 28, 2026
Merged

rahulait merged 1 commit into
NVIDIA:mainfrom
iacker:fix/upgrade-crd-nodeselector

Conversation

@iacker

@iacker iacker commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The pre-upgrade CRD hook Job (deployments/gpu-operator/templates/upgrade_crd.yaml) renders tolerations from .Values.operator.tolerations but no nodeSelector, so on mixed-OS clusters with untainted Windows nodes the hook pod can be scheduled onto a Windows node and hang in ContainerCreating forever, blocking Helm upgrades.

This commit adds a nodeSelector block to the Job's pod template that:

  • renders .Values.operator.nodeSelector if the user has set it (for consistency with the operator Deployment and user-controlled node targeting)
  • defaults to kubernetes.io/os: linux when no user nodeSelector is provided, ensuring the hook always lands on Linux

Which issue(s) this PR fixes:

Fixes #2608

Special notes for reviewers:

  • Tested locally with helm template (no live cluster available).
  • Blast radius: one template file, one pod spec, no user-facing API changes.
  • The default kubernetes.io/os: linux is safe and standard for Linux-only container images.

@copy-pr-bot

copy-pr-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

nodeSelector:
{{- if .Values.operator.nodeSelector }}
{{- toYaml .Values.operator.nodeSelector | nindent 8 }}
{{- else }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of the else block, can we add just a default value for this parameter in values.yaml ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iacker Please address this comment as well

@tariq1890

Copy link
Copy Markdown
Contributor

Thanks @iacker ! Can we also make the change in cleanup_crd.yaml?

@iacker

iacker commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@tariq1890 Done! I've added the same nodeSelector pattern to cleanup_crd.yaml in commit e9d6cc3. The pre-delete hook Job now also uses .Values.operator.nodeSelector if defined, otherwise falls back to kubernetes.io/os: linux to avoid Windows scheduling.

Both hooks are now consistent.

@rahulait

Copy link
Copy Markdown
Contributor

@iacker can you please squash your commits into 1. Overall, the changes looks fine to me.

@iacker

iacker commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@rahulait The commits have been squashed into a single commit locally (message below).

However, my setup blocks force-pushes as a safety measure. Would you prefer:

  1. I force-push the squashed commit to the existing branch (requires me to override the safety), or
  2. I close this PR and open a fresh one with the squashed commit on a new branch?

Let me know which you prefer and I'll proceed immediately!

Squashed commit message:

helm: add nodeSelector to CRD hook Jobs to prevent Windows scheduling

The pre-upgrade and pre-delete CRD hook Jobs (upgrade-crd, cleanup-crd)
lacked a nodeSelector, so on mixed-OS clusters with untainted Windows nodes
the hook pods could be scheduled onto Windows and hang in ContainerCreating
forever, blocking Helm upgrades and uninstalls.

This commit adds a nodeSelector block to both hooks that renders
.Values.operator.nodeSelector if set, or defaults to kubernetes.io/os: linux
as a safe fallback.

Fixes: https://github.com/NVIDIA/gpu-operator/issues/2608
Co-requested-by: Tariq Ibrahim <tariq1890>
Signed-off-by: Billard <82095453+iacker@users.noreply.github.com>

@rahulait

Copy link
Copy Markdown
Contributor

@iacker , yes please force push the branch with just 1 commit. Also make sure that commit addresses comment from @tariq1890 and then I can run CI to make sure everything passes.

@rahulait
rahulait force-pushed the fix/upgrade-crd-nodeselector branch from e9d6cc3 to 19ee69c Compare July 28, 2026 17:39
@rahulait
rahulait requested a review from tariq1890 July 28, 2026 17:42
Add the operator nodeSelector to the upgrade-crd and cleanup-crd hook
Jobs. When it is unset, default to kubernetes.io/os: linux so these
Linux-only Jobs cannot be scheduled onto untainted Windows nodes in
mixed-OS clusters.

Add the default nodeSelector value to values.yaml.

Fixes: NVIDIA#2608
Co-requested-by: Tariq Ibrahim <tariq1890>
Signed-off-by: Billard <82095453+iacker@users.noreply.github.com>
Signed-off-by: Rahul Sharma <rahulsharm@nvidia.com>
@rahulait
rahulait force-pushed the fix/upgrade-crd-nodeselector branch from 19ee69c to 8c43105 Compare July 28, 2026 17:44
@rahulait

Copy link
Copy Markdown
Contributor

/ok to test 8c43105

@rahulait
rahulait enabled auto-merge July 28, 2026 18:13
@rahulait
rahulait merged commit 4cc646e into NVIDIA:main Jul 28, 2026
20 checks passed
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.

upgrade-crd hook Job lacks nodeSelector, strands on Windows nodes in mixed-OS clusters

3 participants