Skip to content

Do not ship GPUCluster CR as a helm chart resource - #2716

Closed
rajathagasthya wants to merge 2 commits into
mainfrom
remove-gpucluster-cr-from-chart
Closed

Do not ship GPUCluster CR as a helm chart resource#2716
rajathagasthya wants to merge 2 commits into
mainfrom
remove-gpucluster-cr-from-chart

Conversation

@rajathagasthya

@rajathagasthya rajathagasthya commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Shipping the GPUCluster CR as a chart resource required a helm.sh/resource-policy: keep annotation so that CR deletion would be done by the pre-delete hook (that would use the finalizer) rather than helm. That workaround caused some issues such as helm uninstall printing a misleading "kept due to the resource policy" message for a CR deleted by the hook, and setting gpuCluster.deployCR=false during an upgrade leaving a stale CR behind that conflicts with a newly deployed ClusterPolicy.

This change stops shipping the CR in the chart. The chart now installs only the operator and CRDs. Users will need to create a GPUCluster CR directly (see config/samples/nvidia_v1alpha1_gpucluster.yaml).

Uninstall ordering is now the user's responsibility. A GPUCluster CR must be deleted while the operator is still running, since deleting it after helm uninstall leaves its finalizer unprocessed and the CR stuck in Terminating state. To avoid that from happening silently, the pre-delete hook is repurposed to fail the uninstall while GPUCluster CRs exist, and waits for CRs that are already terminating so an uninstall issued right after a delete still succeeds. The hook only lists CRs; it never deletes them.

Usage

Default install (ClusterPolicy, device-plugin stack) — unchanged:

helm install gpu-operator <chart> -n gpu-operator --create-namespace

Install in DRA mode (GPUCluster):

helm install gpu-operator <chart> -n gpu-operator --create-namespace \
  --set clusterPolicy.deployCR=false \
  --set driver.nvidiaDriverCRD.enabled=true \
  --set driver.nvidiaDriverCRD.deployDefaultCR=true
kubectl apply -f config/samples/nvidia_v1alpha1_gpucluster.yaml

Switching DRA → ClusterPolicy later: delete the GPUCluster CR first (while the operator is running, so its finalizer drains the DRA stack), then flip the flag:

kubectl delete gpucluster gpu-cluster
helm upgrade gpu-operator <chart> -n gpu-operator --set clusterPolicy.deployCR=true

The reverse flip (ClusterPolicy → DRA) has different behavior: the ClusterPolicy CR is chart-managed, so helm upgrade --set clusterPolicy.deployCR=false deletes it and its operands; then create the GPUCluster CR.

Uninstall in DRA mode: delete the GPUCluster CR first and wait for it to be gone (the finalizer needs the operator running), then uninstall:

kubectl delete gpucluster gpu-cluster
helm uninstall gpu-operator -n gpu-operator

Uninstall in ClusterPolicy mode is unchanged: just helm uninstall.

Checklist

  • No secrets, sensitive information, or unrelated changes
  • Lint checks passing (make lint)
  • Generated assets in-sync (make validate-generated-assets)
  • Go mod artifacts in-sync (make validate-modules)
  • Test cases are added for new code paths

Testing

@coveralls

coveralls commented Aug 4, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 38.367% (-0.02%) from 38.385% — remove-gpucluster-cr-from-chart into main

@cdesiniotis

Copy link
Copy Markdown
Contributor

If we decide to do this, I assume we will maintain config/samples/nvidia_v1alpha1_gpucluster.yaml such that it always points to the latest DRA driver release?

@tariq1890

Copy link
Copy Markdown
Contributor

I assume we will maintain config/samples/nvidia_v1alpha1_gpucluster.yaml such that it always points to the latest DRA driver release?

Yes, that is my understanding.

@rajathagasthya

Copy link
Copy Markdown
Contributor Author

If we decide to do this, I assume we will maintain config/samples/nvidia_v1alpha1_gpucluster.yaml such that it always points to the latest DRA driver release?

Yes, I added a Renovate rule to always keep the DRA driver image current in the sample CR.

The sample CR can drift with the API fields over time, but we can be deliberate about it when making API changes. Perhaps even add a make target later that can fail when it's out of sync with the CRD.

Shipping the GPUCluster CR as a chart resource required
a helm.sh/resource-policy keep annotation so that CR deletion would be
done by the pre-delete hook (that would use the finalizer) rather than
helm. That workaround caused some issues such as helm uninstall printing
a misleading "kept due to the resource policy" message for a CR deleted
by the hook, and setting gpuCluster.deployCR=false during an upgrade
leaving a stale CR behind that conflicts with a newly deployed
ClusterPolicy.

This change stops shipping the CR in the chart. The chart now installs
only the operator and CRDs. Users will need to create a GPUCluster CR
directly (see config/samples/nvidia_v1alpha1_gpucluster.yaml).

Uninstall ordering is now the user's responsibility: a GPUCluster CR
must be deleted while the operator is still running, since deleting it
after helm uninstall leaves its finalizer unprocessed and the CR stuck
in Terminating state. To keep that mistake from happening silently, the
pre-delete hook is repurposed as a guard: it fails the uninstall (with
nothing deleted and the operator still running) while GPUCluster CRs
exist, and waits for CRs that are already terminating so an uninstall
issued right after a delete still succeeds. The guard only lists CRs;
it never deletes them.

Signed-off-by: Rajath Agasthya <ragasthya@nvidia.com>
Extend the values.yaml image custom manager to also scan the sample CR,
so it gets the same automated bumps for DCGM and DCGM Exporter images.

Signed-off-by: Rajath Agasthya <ragasthya@nvidia.com>
@rajathagasthya
rajathagasthya force-pushed the remove-gpucluster-cr-from-chart branch from a1f7495 to df7a7b1 Compare August 5, 2026 03:52
@rahulait

rahulait commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

release-image-list and release-rc-assets workflows will also need an update to detect updated dra-driver image and generate assets accordingly.

@rajathagasthya

Copy link
Copy Markdown
Contributor Author

We've decided to bundle the CR in the chart.

@rajathagasthya
rajathagasthya deleted the remove-gpucluster-cr-from-chart branch August 6, 2026 18:17
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.

5 participants