Skip to content

Commit a3719a9

Browse files
Gpu resource driver chart improvements (#76)
* Namespace should use namespace template * Add pod security label to resource driver namespace because hostpath requires privileged * nfd: Allow deploying node feature rules without deploying nfd * Validating admission policy should not have hardcoded service account, use template functions instead * Make cdi spec dirs paths configurable * serviceAccount is deprecated and should not be hardcoded, serviceAccountName is sufficient * Remove default values for namespaceOverride and serviceAccount to use default helper functions instead Signed-off-by: Rouke Broersma <[email protected]>
1 parent 86c700d commit a3719a9

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

charts/intel-gpu-resource-driver/templates/nfd.yaml renamed to charts/intel-gpu-resource-driver/templates/node-feature-rules.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.nfd.enabled }}
1+
{{- if or .Values.nodeFeatureRules.enabled .Values.nfd.enabled }}
22
apiVersion: nfd.k8s-sigs.io/v1alpha1
33
kind: NodeFeatureRule
44
metadata:
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
apiVersion: v1
22
kind: Namespace
33
metadata:
4-
name: intel-gpu-resource-driver
4+
name: {{ include "intel-gpu-resource-driver.namespace" . }}
5+
labels:
6+
pod-security.kubernetes.io/enforce: privileged

charts/intel-gpu-resource-driver/templates/resource-driver.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ spec:
1414
labels:
1515
app: intel-gpu-resource-driver
1616
spec:
17-
serviceAccount: intel-gpu-resource-driver-service-account
1817
serviceAccountName: {{ include "intel-gpu-resource-driver.serviceAccountName" . }}
1918
containers:
2019
- name: kubelet-plugin
@@ -62,18 +61,18 @@ spec:
6261
path: /var/lib/kubelet/plugins
6362
- name: cdi
6463
hostPath:
65-
path: /etc/cdi
64+
path: {{ .Values.cdi.staticPath }}
6665
- name: varruncdi
6766
hostPath:
68-
path: /var/run/cdi
67+
path: {{ .Values.cdi.dynamicPath}}
6968
- name: sysfs
7069
hostPath:
7170
path: /sys
7271
{{- with .Values.kubeletPlugin.tolerations }}
7372
tolerations:
7473
{{- toYaml . | nindent 8 }}
7574
{{- end }}
76-
{{- if .Values.nfd.enabled }}
75+
{{- if or .Values.nodeFeatureRules.enabled .Values.nfd.enabled }}
7776
nodeSelector:
7877
intel.feature.node.kubernetes.io/gpu: "true"
7978
{{- else }}

charts/intel-gpu-resource-driver/templates/validating-admission-policy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spec:
1313
matchConditions:
1414
- name: isRestrictedUser
1515
expression: >-
16-
request.userInfo.username == "system:serviceaccount:intel-gpu-resource-driver:intel-gpu-resource-driver-service-account"
16+
request.userInfo.username == "system:serviceaccount:{{ include "intel-gpu-resource-driver.namespace" . }}:{{ include "intel-gpu-resource-driver.serviceAccountName" . }}"
1717
variables:
1818
- name: userNodeName
1919
expression: >-

charts/intel-gpu-resource-driver/values.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Default values for intel-gpu-resource-driver.
22
nameOverride: ""
3-
namespaceOverride: "intel-gpu-resource-driver"
3+
namespaceOverride: ""
44
fullnameOverride: ""
55
selectorLabelsOverride: {}
66

@@ -14,14 +14,12 @@ image:
1414
serviceAccount:
1515
create: true
1616
annotations: {}
17-
name: intel-gpu-resource-driver-service-account
17+
name: ""
1818
automount: true
1919

2020
kubeletPlugin:
2121
podAnnotations: {}
22-
nodeSelector: {}
23-
# label used when nfd.enabled is true
24-
#intel.feature.node.kubernetes.io/gpu: "true"
22+
nodeSelector: {} # ignored when .Values.nodeFeatureRules.enabled or .Values.nfd.enabled
2523
tolerations:
2624
- key: node-role.kubernetes.io/master
2725
operator: Exists
@@ -37,6 +35,13 @@ kubeletPlugin:
3735
effect: "NoSchedule"
3836
affinity: {}
3937

38+
cdi:
39+
staticPath: /etc/cdi
40+
dynamicPath: /var/run/cdi
41+
42+
nodeFeatureRules:
43+
enabled: false
44+
4045
nfd:
4146
enabled: false # change to true to install NFD to the cluster
4247
nameOverride: intel-gpu-nfd

0 commit comments

Comments
 (0)