...
1apiVersion: apps/v1
2kind: DaemonSet
3metadata:
4 name: virt-macvtap-ds
5 namespace: kubevirt
6spec:
7 selector:
8 matchLabels:
9 name: virt-macvtap-ds
10 template:
11 metadata:
12 labels:
13 name: virt-macvtap-ds
14 spec:
15 serviceAccountName: virt-macvtap-ds
16 hostNetwork: true
17 hostPID: true
18 priorityClassName: edge-p2-critical-services
19 initContainers:
20 - name: macvtap-cni-init
21 image: bzl://cmd/sds/vms/macvtap:container_push
22 command: ["/bin/sh", "-c"]
23 args:
24 - "MA=$(kubectl get IENodes $NODE -o jsonpath='{ .spec.primaryInterface.macAddresses[0] }') \nIF=$(ip a | grep -B 1 \"link/ether $MA\" | awk -F: 'NR==1 { print $2 }' | tr -d \" \" ) \n[ -z \"$IF\" ] && echo \"MAC address $MA not found\" && exit 404 \nprintf '[{\"name\": \"l2host\", \"lowerDevice\":\"%s\", \"mode\":\"bridge\", \"capacity\":10}]' \"$IF\" | tee /host/opt/cni/bin/macvtap.env \nprintf \"\\n\" \n"
25 env:
26 - name: NODE
27 valueFrom:
28 fieldRef:
29 fieldPath: spec.nodeName
30 resources:
31 requests:
32 cpu: "10m"
33 memory: "15Mi"
34 volumeMounts:
35 - name: cni
36 mountPath: /host/opt/cni/bin
37 mountPropagation: Bidirectional
38 imagePullPolicy: IfNotPresent
39 securityContext:
40 privileged: true
41 - name: macvtap-cni-install
42 image: bzl://third_party/k8s/kubevirt:macvtap_cni_container_push
43 command: ["cp", "/macvtap-cni", "/host/opt/cni/bin/macvtap"]
44 resources:
45 requests:
46 cpu: "10m"
47 memory: "15Mi"
48 volumeMounts:
49 - name: cni
50 mountPath: /host/opt/cni/bin
51 mountPropagation: Bidirectional
52 imagePullPolicy: IfNotPresent
53 securityContext:
54 privileged: true
55 containers:
56 - name: macvtap-cni
57 image: bzl://third_party/k8s/kubevirt:macvtap_cni_container_push
58 command: ["sh", "-c"]
59 args:
60 - "export DP_MACVTAP_CONF=\"$(cat /host/opt/cni/bin/macvtap.env)\" \nset \n/macvtap-deviceplugin -v 3 -logtostderr \n"
61 resources:
62 requests:
63 cpu: "60m"
64 memory: "30Mi"
65 volumeMounts:
66 - name: deviceplugin
67 mountPath: /var/lib/kubelet/device-plugins
68 - name: cni
69 mountPath: /host/opt/cni/bin
70 imagePullPolicy: IfNotPresent
71 securityContext:
72 privileged: true
73 volumes:
74 - name: cni
75 hostPath:
76 path: /opt/cni/bin
77 - name: deviceplugin
78 hostPath:
79 path: /var/lib/kubelet/device-plugins
80 imagePullSecrets:
81 - name: edge-docker-pull-secret
View as plain text