@@ -61,18 +61,25 @@ spec:
6161 # Use runc: explicit "void"; otherwise we inherit "all".
6262 - name : NVIDIA_VISIBLE_DEVICES
6363 value : void
64- # In case of the operator-provided driver, another container mounts the
65- # driver onto the host using `mountPropagation: Bidirectional`
66- # (out-of-band of the lifecycle of _this_ pod here). For us to see that
67- # mount, `mountPropagation: HostToContainer` is required (docs: "if any
68- # Pod with Bidirectional mount propagation to the same volume mounts
69- # anything there, the container with HostToContainer mount propagation
70- # will see it.").
7164 volumeMounts :
72- - name : driver-root
65+ {{- if eq "/" .Values.nvidiaDriverRoot }}
66+ volumeMounts :
67+ - name : host-root
7368 mountPath : /driver-root
7469 readOnly : true
70+ {{- else }}
71+ volumeMounts :
72+ - name : driver-root-parent
73+ mountPath : /driver-root-parent
74+ # In case of the operator-provided driver, another container mounts
75+ # the driver onto the host using `mountPropagation: Bidirectional`
76+ # (out-of-band of the lifecycle of _this_ pod here). For us to see
77+ # that mount, `mountPropagation: HostToContainer` is required (docs:
78+ # "if any Pod with Bidirectional mount propagation to the same volume
79+ # mounts anything there, the container with HostToContainer mount
80+ # propagation will see it.").
7581 mountPropagation : HostToContainer
82+ {{- end }}
7683 containers :
7784 {{- if .Values.resources.computeDomains.enabled }}
7885 - name : compute-domains
@@ -197,6 +204,19 @@ spec:
197204 - name : cdi
198205 hostPath :
199206 path : /var/run/cdi
207+ {{- if eq "/" .Values.nvidiaDriverRoot }}
208+ - name : host-root
209+ hostPath :
210+ path : /
211+ {{- else }}
212+ - name : driver-root-parent
213+ hostPath :
214+ # First, remove trailing slash (if exists) and then remove last path
215+ # element with sprig template function `dir`. Examples: /a/b/ -> /a,
216+ # /a/b/c -> /a/b.
217+ path : {{ dir (trimSuffix "/" .Values.nvidiaDriverRoot) }}
218+ type : DirectoryOrCreate
219+ {{- end }}
200220 - name : driver-root
201221 hostPath :
202222 path : {{ .Values.nvidiaDriverRoot }}
0 commit comments