-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy-testbed-default.sh
executable file
·106 lines (100 loc) · 2.02 KB
/
deploy-testbed-default.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
100
101
102
103
#!/bin/bash
# Usage: ./deploy-testbed.sh <node-list-file> <testbed-name> <pvc-name>
if [ $# -lt 3 ]; then
echo "Usage: ./deploy-testbed.sh <node-list-file> <testbed-name> <pvc-name>"
exit 1
fi
YAML="ndn-nfd-${2}.yaml"
cat <<EOF > "$YAML"
EOF
I=0
while read node; do
echo "Node: $node"
NODE=${node}
N="ndn-nfd-${node}-${2}-${I}"
NAME="${N//./-}"
cat <<EOF >> "$YAML"
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${NAME}-p
labels:
app: ${NAME}-p
spec:
replicas: 1
selector:
matchLabels:
app: ${NAME}-p
template:
metadata:
labels:
app: ${NAME}-p
spec:
containers:
- name: ${NAME}-p
image: cbmckni/ndn-tools
command: [ "/bin/bash", "-c", "--" ]
args: [ "tail -f /dev/null" ]
resources:
requests:
cpu: 1
memory: 4Gi
limits:
cpu: 1
memory: 4Gi
volumeMounts:
- name: vol-1
mountPath: /workspace
ports:
- containerPort: 6363
restartPolicy: Always
volumes:
- name: vol-1
persistentVolumeClaim:
claimName: ${3}
EOF
cat <<EOF >> "$YAML"
---
EOF
I=$((I+1))
done < $1
cat <<EOF >> "$YAML"
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${NAME}-r
labels:
app: ${NAME}-r
spec:
replicas: 1
selector:
matchLabels:
app: ${NAME}-r
template:
metadata:
labels:
app: ${NAME}-r
spec:
containers:
- name: ${NAME}-r
image: cbmckni/ndn-tools
command: [ "/bin/bash", "-c", "--" ]
args: [ "tail -f /dev/null" ]
resources:
requests:
cpu: 1
memory: 4Gi
limits:
cpu: 1
memory: 4Gi
volumeMounts:
- name: vol-1
mountPath: /workspace
ports:
- containerPort: 6363
restartPolicy: Always
volumes:
- name: vol-1
persistentVolumeClaim:
claimName: ${3}
EOF