This repository was archived by the owner on Apr 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathtestpmd_pod.sh
executable file
·81 lines (79 loc) · 2.11 KB
/
testpmd_pod.sh
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
CI_DIR="/runner/_work/userspace-cni-network-plugin/userspace-cni-network-plugin/ci/"
kubectl apply -f $CI_DIR/ovs_test_setup/ovs_network_attachment_definition.yaml
worker="kind-control-plane"
numbers=("1" "2")
for number in "${numbers[@]}"; do
docker exec -i kind-control-plane bash -c ' rm -rf "/var/run/openvswitch/app$number"'
docker exec -i kind-control-plane bash -c ' ls -lah /var/run/openvswitch/'
docker exec -i kind-control-plane bash -c ' mkdir -p "/var/run/openvswitch/app$number"'
docker exec -i kind-control-plane bash -c ' mkdir -p "/run/openvswitch/app$number"'
cat << EOF | kubectl apply -f -
---
apiVersion: v1
kind: Pod
metadata:
name: ovs-app$number-$worker
labels:
name: ovs-app$number
namespace: ovs
annotations:
k8s.v1.cni.cncf.io/networks: userspace-ovs-net-1
userspace/mappedDir: /var/lib/cni/usrspcni/
spec:
nodeSelector:
kubernetes.io/hostname: $worker
hostname: ovs-app$number-$worker
subdomain: ovs
containers:
- image: testpmd
imagePullPolicy: IfNotPresent
name: ovs-app$number-$worker
volumeMounts:
- name: podinfo
mountPath: /etc/podinfo
- name: hugepage
mountPath: /hugepages
- name: shared-dir
mountPath: /var/lib/cni/usrspcni/
- name: scripts
mountPath: /scripts/
- name: vfio
mountPath: /dev/vfio/
resources:
requests:
hugepages-2Mi: 1Gi
memory: "500Mi"
cpu: "5"
limits:
hugepages-2Mi: 1Gi
memory: "500Mi"
cpu: "5"
# command: ["/bin/sh"]
# args: ["-c", "sleep inf"]
restartPolicy: Always
volumes:
- name: podinfo
downwardAPI:
items:
- path: "labels"
fieldRef:
fieldPath: metadata.labels
- path: "annotations"
fieldRef:
fieldPath: metadata.annotations
- name: hugepage
emptyDir:
medium: HugePages
- name: shared-dir
# - name: socket
hostPath:
path: /run/openvswitch/app$number
- name: scripts
hostPath:
path: $CI_DIR/ovs_test_setup/
- name: vfio
hostPath:
path: /dev/vfio/
EOF
done