Skip to content

Commit 335ca93

Browse files
committed
qat: add kustomize overlay to enable SR-IOV
This commit adds two initcontainers in a kustomize overlay to QAT deployment. The overlay can be used to prepare QAT setup on a freshly booted system. Note: containerd/cri-o seem to have issues mounting sysfs rw in even if the container is privileged. Therefore, we do a special /sys:/sys bind mount for 'cat sriov_totalvs | tee sriov_numvfs' to work. Signed-off-by: Mikko Ylinen <[email protected]>
1 parent 4107550 commit 335ca93

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
bases:
2+
- ../../base
3+
patchesStrategicMerge:
4+
- sriov_numvfs_init.yaml
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: intel-qat-plugin
5+
spec:
6+
template:
7+
spec:
8+
initContainers:
9+
- name: vfio-pci
10+
image: busybox
11+
command: ["/bin/sh", "-c", "modprobe vfio-pci"]
12+
securityContext:
13+
capabilities:
14+
add:
15+
["SYS_MODULE"]
16+
volumeMounts:
17+
- name: moddir
18+
mountPath: /lib/modules/
19+
- name: sriov-numvfs
20+
image: busybox
21+
command: ["/bin/sh", "-c"]
22+
args:
23+
- >
24+
for dev in `for pf in 0434 0435 19a3 37c8 6f54; do lspci | awk -v dev="8086:$pf" '$0 ~ dev {print "0000:" $1}'; done`; do
25+
DEVPATH="/sys/bus/pci/devices/$dev"
26+
NUMVFS="$DEVPATH/sriov_numvfs"
27+
if [ -w "$NUMVFS" -a $(cat "$NUMVFS") -eq 0 ]; then
28+
cat "$DEVPATH/sriov_totalvfs" | tee "$NUMVFS"
29+
fi
30+
done
31+
securityContext:
32+
privileged: true
33+
volumeMounts:
34+
- name: sysfs
35+
mountPath: /sys
36+
volumes:
37+
- name: moddir
38+
hostPath:
39+
path: /lib/modules/
40+
- name: sysfs
41+
hostPath:
42+
path: /sys

0 commit comments

Comments
 (0)