Skip to content

Allow CDI hooks to be disabled#1818

Merged
cdesiniotis merged 1 commit into
NVIDIA:mainfrom
cdesiniotis:cdi-disable-hooks
May 28, 2026
Merged

Allow CDI hooks to be disabled#1818
cdesiniotis merged 1 commit into
NVIDIA:mainfrom
cdesiniotis:cdi-disable-hooks

Conversation

@cdesiniotis
Copy link
Copy Markdown
Contributor

@cdesiniotis cdesiniotis commented May 28, 2026

Testing

$ grep "ModifyDeviceFile" /proc/driver/nvidia/params
ModifyDeviceFiles: 1

$ cat pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: gpu-sleep
spec:
  restartPolicy: Never
  containers:
    - name: main
      image: ubuntu
      command: ["sh", "-c", "sleep infinity"]
      resources:
        limits:
          nvidia.com/gpu: 1

$ kubectl apply -f pod.yaml
pod/gpu-sleep created

$ kubectl exec -it gpu-sleep -- grep "ModifyDeviceFile" /proc/driver/nvidia/params
ModifyDeviceFiles: 0

$ kubectl delete -f pod.yaml
pod "gpu-sleep" deleted from default namespace

// add below env to device-plugin daemonset
// env:
// - name: CDI_DISABLE_HOOKS
     value: "disable-device-node-modification, update-ldcache"

// after plugin restarts, observe that boths hooks are omitted from the generated CDI spec

$ kubectl apply -f pod.yaml
pod/gpu-sleep created

$ kubectl exec -it gpu-sleep -- grep "ModifyDeviceFile" /proc/driver/nvidia/params
ModifyDeviceFiles: 1

@cdesiniotis cdesiniotis requested a review from tariq1890 May 28, 2026 18:40
@cdesiniotis cdesiniotis marked this pull request as ready for review May 28, 2026 18:40
@cdesiniotis
Copy link
Copy Markdown
Contributor Author

I updated the description of the cdi-disabled-hooks flag to also include:

The special hook name 'all' can be used to ensure the generated CDI specification does not include any hooks.

@cdesiniotis cdesiniotis enabled auto-merge May 28, 2026 18:56
@cdesiniotis cdesiniotis self-assigned this May 28, 2026
@cdesiniotis cdesiniotis added this to the v0.20.0 milestone May 28, 2026
@LandonTClipp
Copy link
Copy Markdown

Thank you @cdesiniotis!

Comment thread cmd/nvidia-device-plugin/main.go Outdated
@cdesiniotis cdesiniotis disabled auto-merge May 28, 2026 19:14
Signed-off-by: Christopher Desiniotis <cdesiniotis@nvidia.com>
@cdesiniotis cdesiniotis merged commit 041d4d4 into NVIDIA:main May 28, 2026
11 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.

3 participants