Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 23647a9

Browse files
committedDec 17, 2024·
Use NVIDIA_CDI_HOOK_PATH instead of NVIDIA_CTK_PATH
Signed-off-by: rongfu.leng <[email protected]>
1 parent 32805fe commit 23647a9

File tree

8 files changed

+29
-29
lines changed

8 files changed

+29
-29
lines changed
 

‎cmd/nvidia-dra-plugin/cdi.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ const (
4848
)
4949

5050
type CDIHandler struct {
51-
logger *logrus.Logger
52-
nvml nvml.Interface
53-
nvdevice nvdevice.Interface
54-
nvcdiDevice nvcdi.Interface
55-
nvcdiClaim nvcdi.Interface
56-
cache *cdiapi.Cache
57-
driverRoot string
58-
devRoot string
59-
targetDriverRoot string
60-
nvidiaCTKPath string
51+
logger *logrus.Logger
52+
nvml nvml.Interface
53+
nvdevice nvdevice.Interface
54+
nvcdiDevice nvcdi.Interface
55+
nvcdiClaim nvcdi.Interface
56+
cache *cdiapi.Cache
57+
driverRoot string
58+
devRoot string
59+
targetDriverRoot string
60+
nvidiaCDIHookPath string
6161

6262
cdiRoot string
6363
vendor string
@@ -103,7 +103,7 @@ func NewCDIHandler(opts ...cdiOption) (*CDIHandler, error) {
103103
nvcdi.WithMode("nvml"),
104104
nvcdi.WithVendor(h.vendor),
105105
nvcdi.WithClass(h.deviceClass),
106-
nvcdi.WithNVIDIACDIHookPath(h.nvidiaCTKPath),
106+
nvcdi.WithNVIDIACDIHookPath(h.nvidiaCDIHookPath),
107107
)
108108
if err != nil {
109109
return nil, fmt.Errorf("unable to create CDI library for devices: %w", err)
@@ -120,7 +120,7 @@ func NewCDIHandler(opts ...cdiOption) (*CDIHandler, error) {
120120
nvcdi.WithMode("nvml"),
121121
nvcdi.WithVendor(h.vendor),
122122
nvcdi.WithClass(h.claimClass),
123-
nvcdi.WithNVIDIACDIHookPath(h.nvidiaCTKPath),
123+
nvcdi.WithNVIDIACDIHookPath(h.nvidiaCDIHookPath),
124124
)
125125
if err != nil {
126126
return nil, fmt.Errorf("unable to create CDI library for claims: %w", err)

‎cmd/nvidia-dra-plugin/cdioptions.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ func WithCDIRoot(cdiRoot string) cdiOption {
5252
}
5353
}
5454

55-
// WithNvidiaCTKPath provides an cdiOption to set the nvidia-ctk path used by the 'cdi' interface.
56-
func WithNvidiaCTKPath(path string) cdiOption {
55+
// WithNvidiaCDIHookPath provides an cdiOption to set the nvidia-cdi-hook path used by the 'cdi' interface.
56+
func WithNvidiaCDIHookPath(path string) cdiOption {
5757
return func(c *CDIHandler) {
58-
c.nvidiaCTKPath = path
58+
c.nvidiaCDIHookPath = path
5959
}
6060
}
6161

‎cmd/nvidia-dra-plugin/device_state.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func NewDeviceState(ctx context.Context, config *Config) (*DeviceState, error) {
7676
WithDriverRoot(string(containerDriverRoot)),
7777
WithDevRoot(devRoot),
7878
WithTargetDriverRoot(hostDriverRoot),
79-
WithNvidiaCTKPath(config.flags.nvidiaCTKPath),
79+
WithNvidiaCDIHookPath(config.flags.nvidiaCDIHookPath),
8080
WithCDIRoot(config.flags.cdiRoot),
8181
WithVendor(cdiVendor),
8282
)

‎cmd/nvidia-dra-plugin/main.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type Flags struct {
5050
cdiRoot string
5151
containerDriverRoot string
5252
hostDriverRoot string
53-
nvidiaCTKPath string
53+
nvidiaCDIHookPath string
5454
deviceClasses sets.Set[string]
5555
}
5656

@@ -108,11 +108,11 @@ func newApp() *cli.App {
108108
EnvVars: []string{"CONTAINER_DRIVER_ROOT"},
109109
},
110110
&cli.StringFlag{
111-
Name: "nvidia-ctk-path",
112-
Value: "/usr/bin/nvidia-ctk",
113-
Usage: "the path to use for the nvidia-ctk in the generated CDI specification. Note that this represents the path on the host.",
114-
Destination: &flags.nvidiaCTKPath,
115-
EnvVars: []string{"NVIDIA_CTK_PATH"},
111+
Name: "nvidia-cdi-hook-path",
112+
Value: "/usr/bin/nvidia-cdi-hook",
113+
Usage: "the path to use for the nvidia-cdi-hook in the generated CDI specification. Note that this represents the path on the host.",
114+
Destination: &flags.nvidiaCDIHookPath,
115+
EnvVars: []string{"NVIDIA_CDI_HOOK_PATH"},
116116
},
117117
&cli.StringSliceFlag{
118118
Name: "device-classes",

‎demo/clusters/kind/install-dra-driver.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ kubectl label node -l node-role.x-k8s.io/worker --overwrite nvidia.com/gpu.prese
2727
deviceClasses=${1:-"gpu,mig,imex"}
2828
helm upgrade -i --create-namespace --namespace nvidia nvidia-dra-driver ${PROJECT_DIR}/deployments/helm/k8s-dra-driver \
2929
--set deviceClasses="{${deviceClasses}}" \
30-
${NVIDIA_CTK_PATH:+--set nvidiaCtkPath=${NVIDIA_CTK_PATH}} \
30+
${NVIDIA_CDI_HOOK_PATH:+--set nvidiaCDIHookPath=${NVIDIA_CDI_HOOK_PATH}} \
3131
${NVIDIA_DRIVER_ROOT:+--set nvidiaDriverRoot=${NVIDIA_DRIVER_ROOT}} \
3232
${MASK_NVIDIA_DRIVER_PARAMS:+--set maskNvidiaDriverParams=${MASK_NVIDIA_DRIVER_PARAMS}} \
3333
--wait

‎demo/clusters/kind/scripts/kind-cluster-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ nodes:
6464
# we mount it from the host.
6565
# TODO: Remove this once we have a more stable solution to make `nvidia-ctk`
6666
# on the kind nodes.
67-
- hostPath: /usr/bin/nvidia-ctk
68-
containerPath: /usr/bin/nvidia-ctk
67+
- hostPath: /usr/bin/nvidia-cdi-hook
68+
containerPath: /usr/bin/nvidia-cdi-hook

‎deployments/helm/k8s-dra-driver/templates/kubeletplugin.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ spec:
7171
env:
7272
- name: MASK_NVIDIA_DRIVER_PARAMS
7373
value: "{{ .Values.maskNvidiaDriverParams }}"
74-
- name: NVIDIA_CTK_PATH
75-
value: "{{ .Values.nvidiaCtkPath }}"
74+
- name: NVIDIA_CDI_HOOK_PATH
75+
value: "{{ .Values.nvidiaCDIHookPath }}"
7676
- name: NVIDIA_DRIVER_ROOT
7777
value: "{{ .Values.nvidiaDriverRoot }}"
7878
- name: NVIDIA_VISIBLE_DEVICES

‎deployments/helm/k8s-dra-driver/values.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
# For driver installed directly on a host, a value of `/` is used.
2323
nvidiaDriverRoot: /
2424

25-
# Specify the path of CTK binary (nvidia-ctk) on the host,
25+
# Specify the path of cdi hook (nvidia-cdi-hook) on the host,
2626
# as it should appear in the the generated CDI specification.
2727
# The path depends on the system that runs on the node.
28-
nvidiaCtkPath: /usr/bin/nvidia-ctk
28+
nvidiaCDIHookPath: /usr/bin/nvidia-cdi-hook
2929

3030
nameOverride: ""
3131
fullnameOverride: ""

0 commit comments

Comments
 (0)
Please sign in to comment.