Skip to content

Commit 958dcf6

Browse files
committed
Merge branch 'cherry-picks-for-v0.12.3' into 'release-0.12'
Cherry-picks from master into release-0.12 branch for v0.12.3 See merge request nvidia/kubernetes/device-plugin!207
2 parents 6815626 + 91c56ec commit 958dcf6

File tree

15 files changed

+61
-19
lines changed

15 files changed

+61
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ version = 2
111111
runtime_root = ""
112112
runtime_type = "io.containerd.runc.v2"
113113
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia.options]
114-
BinaryName = "/usr/bin/nvidia-container-runtime
114+
BinaryName = "/usr/bin/nvidia-container-runtime"
115115
```
116116
And then restart `containerd`:
117117
```

deployments/container/Dockerfile.ubi8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ RUN make PREFIX=/artifacts cmds
2727

2828
FROM nvidia/${CUDA_IMAGE}:${CUDA_VERSION}-base-${BASE_DIST}
2929

30+
# Remove CUDA libs(compat etc) in favor of libs installed by the NVIDIA driver
31+
RUN dnf remove -y cuda-*
32+
3033
ENV NVIDIA_DISABLE_REQUIRE="true"
3134
ENV NVIDIA_VISIBLE_DEVICES=all
3235
ENV NVIDIA_DRIVER_CAPABILITIES=utility

deployments/container/Dockerfile.ubuntu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ RUN make PREFIX=/artifacts cmds
2727

2828
FROM nvidia/${CUDA_IMAGE}:${CUDA_VERSION}-base-${BASE_DIST}
2929

30+
# Remove CUDA libs(compat etc) in favor of libs installed by the NVIDIA driver
31+
RUN apt-get --purge -y autoremove cuda-*
32+
3033
ENV NVIDIA_DISABLE_REQUIRE="true"
3134
ENV NVIDIA_VISIBLE_DEVICES=all
3235
ENV NVIDIA_DRIVER_CAPABILITIES=utility
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{/*
2+
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
3+
*/}}
4+
{{- define "gpu-feature-discovery.namespace" -}}
5+
{{- if .Values.namespaceOverride -}}
6+
{{- .Values.namespaceOverride -}}
7+
{{- else -}}
8+
{{- .Release.Namespace -}}
9+
{{- end -}}
10+
{{- end -}}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{- if and (eq (include "gpu-feature-discovery.namespace" .) "default") ( eq .Values.namespaceOverride "") (not .Values.allowDefaultNamespace) }}
2+
{{- $error := "" }}
3+
{{- $error = printf "%s\nRunning in the 'default' namespace is not recommended." $error }}
4+
{{- $error = printf "%s\nSet 'allowDefaultNamespace=true' to bypass this error." $error }}
5+
{{- $error = printf "%s\nOtherwise, use --namespace (with --create-namespace as necessary) to run in a specific namespace." $error }}
6+
{{- $error = printf "%s\nSee: https://helm.sh/docs/helm/helm_install/#options" $error }}
7+
{{- fail $error }}
8+
{{- end }}

deployments/helm/nvidia-device-plugin/charts/gpu-feature-discovery/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sleepInterval: null
33

44
nameOverride: ""
55
fullnameOverride: ""
6+
namespaceOverride: ""
67
selectorLabelsOverride: {}
78

89
imagePullSecrets: []

deployments/helm/nvidia-device-plugin/templates/_helpers.tpl

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ If release name contains chart name it will be used as a full name.
2424
{{- end -}}
2525
{{- end -}}
2626

27+
{{/*
28+
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
29+
*/}}
30+
{{- define "nvidia-device-plugin.namespace" -}}
31+
{{- if .Values.namespaceOverride -}}
32+
{{- .Values.namespaceOverride -}}
33+
{{- else -}}
34+
{{- .Release.Namespace -}}
35+
{{- end -}}
36+
{{- end -}}
37+
2738
{{/*
2839
Create chart name and version as used by the chart label.
2940
*/}}
@@ -79,17 +90,17 @@ Security context for the plugin
7990
*/}}
8091
{{- define "nvidia-device-plugin.securityContext" -}}
8192
{{- if ne (len .Values.securityContext) 0 -}}
82-
{{ toYaml .Values.securityContext }}
93+
{{ toYaml .Values.securityContext }}
8394
{{- else if .Values.compatWithCPUManager -}}
84-
privileged: true
95+
privileged: true
8596
{{- else if ne (include "nvidia-device-plugin.allPossibleMigStrategiesAreNone" .) "true" -}}
86-
capabilities:
87-
add:
88-
- SYS_ADMIN
97+
capabilities:
98+
add:
99+
- SYS_ADMIN
89100
{{- else -}}
90-
allowPrivilegeEscalation: false
91-
capabilities:
92-
drop: ["ALL"]
101+
allowPrivilegeEscalation: false
102+
capabilities:
103+
drop: ["ALL"]
93104
{{- end -}}
94105
{{- end -}}
95106

@@ -98,15 +109,15 @@ Security context for GFD
98109
*/}}
99110
{{- define "gpu-feature-discovery.securityContext" -}}
100111
{{- if ne (len .Subcharts.gfd.Values.securityContext) 0 -}}
101-
{{ toYaml .Subcharts.gfd.Values.securityContext }}
112+
{{ toYaml .Subcharts.gfd.Values.securityContext }}
102113
{{- else if ne (include "nvidia-device-plugin.allPossibleMigStrategiesAreNone" .) "true" -}}
103-
capabilities:
104-
add:
105-
- SYS_ADMIN
114+
capabilities:
115+
add:
116+
- SYS_ADMIN
106117
{{- else -}}
107-
allowPrivilegeEscalation: false
108-
capabilities:
109-
drop: ["ALL"]
118+
allowPrivilegeEscalation: false
119+
capabilities:
120+
drop: ["ALL"]
110121
{{- end -}}
111122
{{- end -}}
112123

deployments/helm/nvidia-device-plugin/templates/configmap.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: ConfigMap
44
metadata:
55
name: {{ include "nvidia-device-plugin.configMapName" . }}
6+
namespace: {{ include "nvidia-device-plugin.namespace" . }}
67
labels:
78
{{- include "nvidia-device-plugin.labels" . | nindent 4 }}
89
data:

deployments/helm/nvidia-device-plugin/templates/daemonset.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ apiVersion: apps/v1
2424
kind: DaemonSet
2525
metadata:
2626
name: {{ include "nvidia-device-plugin.fullname" . }}
27+
namespace: {{ include "nvidia-device-plugin.namespace" . }}
2728
labels:
2829
{{- include "nvidia-device-plugin.labels" . | nindent 4 }}
2930
spec:

deployments/helm/nvidia-device-plugin/templates/gfd.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ apiVersion: apps/v1
2424
kind: DaemonSet
2525
metadata:
2626
name: {{ include "nvidia-device-plugin.fullname" . }}
27+
namespace: {{ include "nvidia-device-plugin.namespace" . }}
2728
labels:
2829
{{- include "nvidia-device-plugin.labels" . | nindent 4 }}
2930
spec:

0 commit comments

Comments
 (0)