Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/device-plugin/nvidiadevice/nvinternal/plugin/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ func (plugin *NvidiaDevicePlugin) apiDevices() []*kubeletdevicepluginv1beta1.Dev

func (plugin *NvidiaDevicePlugin) apiEnvs(envvar string, deviceIDs []string) map[string]string {
return map[string]string{
envvar: strings.Join(deviceIDs, ","),
envvar: "nvidia.com/gpu=" + strings.Join(deviceIDs, ","),
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

This change incorrectly formats the NVIDIA_VISIBLE_DEVICES environment variable for CDI support, especially for multi-GPU scenarios.

When multiple deviceIDs are provided (e.g., ["id1", "id2"]), this will produce NVIDIA_VISIBLE_DEVICES=nvidia.com/gpu=id1,id2. This is not a valid format. A list of CDI devices would be nvidia.com/gpu=id1,nvidia.com/gpu=id2.

More importantly, NVIDIA_VISIBLE_DEVICES is part of the legacy integration with the NVIDIA container toolkit and should contain a comma-separated list of device UUIDs or indices (e.g., id1,id2).

CDI support is correctly handled via CDI annotations, which are generated by the getAllocateResponseForCDI function and enabled when the device-list-strategy includes cdi-annotations. The container runtime then uses these annotations to make devices available inside the container.

Therefore, this change is not necessary and breaks the existing environment variable-based device selection. The original implementation was correct.

Suggested change
envvar: "nvidia.com/gpu=" + strings.Join(deviceIDs, ","),
envvar: strings.Join(deviceIDs, ","),

Copy link
Author

Choose a reason for hiding this comment

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

nah buddy u r wrong.

}
}

Expand Down
Loading