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 pathvpp_host.sh
executable file
·100 lines (90 loc) · 2.13 KB
/
vpp_host.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
# Set USERSPACEDIR if not defined in parent script
USERSPACEDIR="${USERSPACEDIR:=/runner/_work/userspace-cni-network-plugin/userspace-cni-network-plugin/}"
kubectl delete ns vpp
kubectl create ns vpp
kubectl create -n vpp configmap vpp-startup-config --from-file="${USERSPACEDIR}/docker/vpp-centos-userspace-cni/startup.conf"
worker="kind-control-plane"
rm /opt/cni/bin/userspace
docker exec -i kind-control-plane bash -c "mkdir -p /var/run/vpp/app"
cat << EOF | kubectl apply -f -
---
apiVersion: v1
kind: Pod
metadata:
name: userspacecni-$worker
namespace: vpp
spec:
nodeSelector:
kubernetes.io/hostname: $worker
containers:
- name: userspacecni-$worker
image: userspacecni:latest
imagePullPolicy: IfNotPresent
volumeMounts:
- name: cni
mountPath: /opt/cni/bin
volumes:
- name: cni
hostPath:
path: /opt/cni/bin
restartPolicy: Never
EOF
echo "sleeping for 20 to allow userspace to deploy first"
sleep 20
cat << EOF | kubectl apply -f -
---
apiVersion: v1
kind: Pod
metadata:
name: vpp-$worker
labels:
name: vpp
namespace: vpp
spec:
nodeSelector:
kubernetes.io/hostname: $worker
hostname: vpp-$worker
subdomain: vpp
containers:
- image: ligato/vpp-base:23.02 #imagename
imagePullPolicy: IfNotPresent
name: vpp-$worker
volumeMounts:
- name: vpp-api
mountPath: /run/vpp/
- name: vpp-run
mountPath: /var/run/vpp/
- name: vpp-startup-config
mountPath: /etc/vpp/
- name: hugepage
mountPath: /hugepages
- name: userspace-api
mountPath: /var/lib/cni/usrspcni/
resources:
requests:
hugepages-2Mi: 1Gi
memory: "1Gi"
cpu: "3"
limits:
hugepages-2Mi: 1Gi
memory: "1Gi"
cpu: "3"
restartPolicy: Always
volumes:
- name: vpp-run
hostPath:
path: /var/run/vpp/
- name: vpp-api
hostPath:
path: /run/vpp/
- name: userspace-api
hostPath:
path: /var/lib/cni/usrspcni/
- name: vpp-startup-config
configMap:
name: vpp-startup-config
- name: hugepage
emptyDir:
medium: HugePages
EOF