Skip to content

Commit 6e4a768

Browse files
committed
Use intel-gpu-plugin with intel-gpu-fakedev generated devices
Adding new kustomization (base) directory for this is (a bit simpler) alternative than kustomizing existing gpu_plugin/ base, which requires changing current initcontainer to a run-time one, and adding init container for fake device generator. See: intel#1118 Signed-off-by: Eero Tamminen <[email protected]>
1 parent 2177d12 commit 6e4a768

File tree

4 files changed

+123
-0
lines changed

4 files changed

+123
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Info": "8x 4 GiB DG1 [Iris Xe MAX Graphics] GPUs",
3+
"DevCount": 8,
4+
"DevMemSize": 4294967296,
5+
"Capabilities": {
6+
"platform": "fake_DG1"
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: intel-gpu-plugin-fake
5+
labels:
6+
app: intel-gpu-plugin-fake
7+
spec:
8+
selector:
9+
matchLabels:
10+
app: intel-gpu-plugin-fake
11+
template:
12+
metadata:
13+
labels:
14+
app: intel-gpu-plugin-fake
15+
spec:
16+
initContainers:
17+
- name: fakedev-generator
18+
image: intel/intel-gpu-fakedev:devel
19+
imagePullPolicy: IfNotPresent
20+
securityContext:
21+
readOnlyRootFilesystem: false
22+
allowPrivilegeEscalation: false
23+
capabilities:
24+
drop: [ "ALL" ]
25+
add: [ "MKNOD" ]
26+
# container runtime prevents writing to /sys & /dev,
27+
# so volumes need to be mounted elsewhere
28+
volumeMounts:
29+
- name: devfs
30+
mountPath: /tmp/fakedev/dev
31+
readOnly: false
32+
- name: sysfs
33+
mountPath: /tmp/fakedev/sys
34+
readOnly: false
35+
- name: fake-conf
36+
mountPath: /config
37+
readOnly: true
38+
# files are generated under CWD
39+
workingDir: /tmp/fakedev
40+
# generate fake sysfs / devfs files for GPU plugin based on config
41+
command: ["/generator", "-json", "/config/fakedev.json", "-verbose"]
42+
- name: intel-gpu-initcontainer
43+
# convert generated sysfs content to NFD feature labels file
44+
image: intel/intel-gpu-initcontainer:devel
45+
imagePullPolicy: IfNotPresent
46+
securityContext:
47+
readOnlyRootFilesystem: true
48+
allowPrivilegeEscalation: false
49+
capabilities:
50+
drop: [ "ALL" ]
51+
# expects sysfs here
52+
volumeMounts:
53+
- name: sysfs
54+
mountPath: /host-sys
55+
readOnly: true
56+
- name: nfd-features
57+
mountPath: /nfd
58+
readOnly: false
59+
workingDir: /usr/local/bin/gpu-sw
60+
# needed until GPU plugin drops NFD hook usage due to:
61+
# https://github.com/kubernetes-sigs/node-feature-discovery/issues/856
62+
command: ["sh", "-c", "./intel-gpu-nfdhook | tee /nfd/fake-gpu"]
63+
containers:
64+
- name: intel-gpu-plugin
65+
env:
66+
- name: NODE_NAME
67+
valueFrom:
68+
fieldRef:
69+
fieldPath: spec.nodeName
70+
image: intel/intel-gpu-plugin:devel
71+
imagePullPolicy: IfNotPresent
72+
securityContext:
73+
readOnlyRootFilesystem: true
74+
allowPrivilegeEscalation: false
75+
capabilities:
76+
drop: [ "ALL" ]
77+
args: [ "-prefix=/tmp/fakedev" ]
78+
# devfs host & container paths must match for everything to work
79+
volumeMounts:
80+
- name: devfs
81+
mountPath: /tmp/fakedev/dev
82+
readOnly: true
83+
- name: sysfs
84+
mountPath: /tmp/fakedev/sys
85+
readOnly: true
86+
- name: kubeletsockets
87+
mountPath: /var/lib/kubelet/device-plugins
88+
volumes:
89+
- name: devfs
90+
hostPath:
91+
path: /tmp/fakedev/dev
92+
type: DirectoryOrCreate
93+
- name: sysfs
94+
hostPath:
95+
emptyDir: {}
96+
- name: fake-conf
97+
configMap:
98+
name: fakedev-config
99+
- name: kubeletsockets
100+
hostPath:
101+
path: /var/lib/kubelet/device-plugins
102+
- name: nfd-features
103+
hostPath:
104+
path: /etc/kubernetes/node-feature-discovery/features.d/
105+
type: DirectoryOrCreate
106+
nodeSelector:
107+
kubernetes.io/arch: amd64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
configMapGenerator:
2+
- name: fakedev-config
3+
files:
4+
- fakedev-config.json
5+
resources:
6+
- intel-gpu-plugin.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bases:
2+
- base

0 commit comments

Comments
 (0)