forked from openshift-kni/baremetal-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10-sriov-daemonset.yaml
66 lines (64 loc) · 1.96 KB
/
10-sriov-daemonset.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
kind: ConfigMap
apiVersion: v1
metadata:
name: sriov-unsupported-nics-entrypoint
data:
entrypoint.sh: |
#!/bin/sh
set -euo pipefail
echo "########################################"
echo "# Apply udev rules in unsupported NICs #"
echo "########################################"
OPERATORUDEVRULES="/etc/udev/rules.d/10-nm-unmanaged.rules"
CUSTOMUDEVRULES="/etc/udev/rules.d/11-custom-nm-unmanaged.rules"
if [ -f ${CUSTOMUDEVRULES} ] || [ -f ${OPERATORUDEVRULES} ]; then
while true ; do
echo "udev rules already applied, sleep loop"
sleep 3600
done
else
UDEVDEVICE=$(cat /sys/class/net/${nic}/device/sriov_vf_device)
echo "ACTION==\"add|change\", ATTRS{device}==\"0x${UDEVDEVICE}\", ENV{NM_UNMANAGED}=\"1\"" > ${CUSTOMUDEVRULES}
udevadm control --reload-rules
udevadm trigger
fi
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: sriov-unsupported-nics-ds
labels:
app: sriov-unsupported-nics-ds
spec:
selector:
matchLabels:
app: sriov-unsupported-nics-ds
template:
metadata:
labels:
app: sriov-unsupported-nics-ds
spec:
serviceAccount: sriov-network-config-daemon
nodeSelector:
${NODESELECTOR}
containers:
- name: sriov-unsupported-nics
image: ubi8/ubi-minimal
command: ['sh', '-c', 'cp /script/entrypoint.sh /host/tmp && chmod +x /host/tmp/entrypoint.sh && echo "Creating udev rules" && chroot /host /tmp/entrypoint.sh && sleep infinity']
securityContext:
privileged: true
volumeMounts:
- mountPath: /script
name: sriov-unsupported-nics-script
- mountPath: /host
name: host
restartPolicy: Always
terminationGracePeriodSeconds: 10
volumes:
- configMap:
name: sriov-unsupported-nics-entrypoint
name: sriov-unsupported-nics-script
- hostPath:
path: /
type: Directory
name: host