Merge pull request #455 from mythi/sriov

qat: add kustomize overlay to enable SR-IOV
This commit is contained in:
Dmitry Rozhkov 2020-09-15 10:08:05 +03:00 committed by GitHub
commit a9e4b9f6e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,4 @@
bases:
- ../../base
patchesStrategicMerge:
- sriov_numvfs_init.yaml

View File

@ -0,0 +1,42 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: intel-qat-plugin
spec:
template:
spec:
initContainers:
- name: vfio-pci
image: busybox
command: ["/bin/sh", "-c", "modprobe vfio-pci"]
securityContext:
capabilities:
add:
["SYS_MODULE"]
volumeMounts:
- name: moddir
mountPath: /lib/modules/
- name: sriov-numvfs
image: busybox
command: ["/bin/sh", "-c"]
args:
- >
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
DEVPATH="/sys/bus/pci/devices/$dev"
NUMVFS="$DEVPATH/sriov_numvfs"
if [ -w "$NUMVFS" -a $(cat "$NUMVFS") -eq 0 ]; then
cat "$DEVPATH/sriov_totalvfs" | tee "$NUMVFS"
fi
done
securityContext:
privileged: true
volumeMounts:
- name: sysfs
mountPath: /sys
volumes:
- name: moddir
hostPath:
path: /lib/modules/
- name: sysfs
hostPath:
path: /sys