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_pod.sh
executable file
·80 lines (77 loc) · 2.13 KB
/
vpp_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
#!/bin/bash
# set CI_DIR if not defined in parent script
CI_DIR="${CI_DIR:=/runner/_work/userspace-cni-network-plugin/userspace-cni-network-plugin/ci/}"
kubectl apply -f "$CI_DIR/vpp_test_setup/network_attachment_definition.yaml"
kubectl create -n vpp configmap vpp-app-startup-config --from-file="$CI_DIR/vpp_test_setup/startup.conf"
worker="kind-control-plane"
numbers=("1" "2")
for number in "${numbers[@]}"; do
docker exec -i kind-control-plane bash -c "rm -rf /var/run/vpp/app$number"
docker exec -i kind-control-plane bash -c "ls -lah /var/run/vpp/"
docker exec -i kind-control-plane bash -c "mkdir -p /var/run/vpp/app$number"
cat << EOF | kubectl apply -f -
---
apiVersion: v1
kind: Pod
metadata:
name: vpp-app$number-$worker
labels:
name: vpp-app$number
namespace: vpp
annotations:
k8s.v1.cni.cncf.io/networks: userspace-vpp-net-1
userspace/mappedDir: /var/lib/cni/usrspcni/
spec:
nodeSelector:
kubernetes.io/hostname: $worker
hostname: vpp-app$number-$worker
subdomain: vpp
containers:
- image: ligato/vpp-base:23.02 #imagename
imagePullPolicy: IfNotPresent
name: vpp-app$number-$worker
volumeMounts:
- name: podinfo
mountPath: /etc/podinfo
- name: vpp-startup-config
mountPath: /etc/vpp/
- name: hugepage
mountPath: /hugepages
- name: shared-dir
mountPath: /var/lib/cni/usrspcni/
- name: scripts
mountPath: /vpp/
resources:
requests:
hugepages-2Mi: 1Gi
memory: "1Gi"
cpu: "3"
limits:
hugepages-2Mi: 1Gi
memory: "1Gi"
cpu: "3"
restartPolicy: Always
volumes:
- name: podinfo
downwardAPI:
items:
- path: "labels"
fieldRef:
fieldPath: metadata.labels
- path: "annotations"
fieldRef:
fieldPath: metadata.annotations
- name: vpp-startup-config
configMap:
name: vpp-startup-config
- name: hugepage
emptyDir:
medium: HugePages
- name: shared-dir
hostPath:
path: /run/vpp/app$number
- name: scripts
hostPath:
path: $CI_DIR/vpp_test_setup/
EOF
done