-
Notifications
You must be signed in to change notification settings - Fork 0
/
load-configuration.sh
executable file
·93 lines (83 loc) · 2.06 KB
/
load-configuration.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
#!/bin/bash
CONFIG_DIRECTORY=${1:-"configuration"}
echo "using configuration: from '${CONFIG_DIRECTORY}'"
kubectl apply -f - <<EOF
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: network-configs
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
EOF
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: temp-network-configs-pod
spec:
containers:
- name: temp-container
image: busybox
command: ["sleep", "3600"]
volumeMounts:
- mountPath: /network-configs
name: my-volume
securityContext:
fsGroup: 10001 # to be same group as the lighthouse container
volumes:
- name: my-volume
persistentVolumeClaim:
claimName: network-configs
restartPolicy: Never
EOF
sleep 10
kubectl cp $CONFIG_DIRECTORY/network-configs temp-network-configs-pod:/
# check
kubectl exec -it temp-network-configs-pod -- chmod -R 777 network-configs # need to figure out permission later
kubectl exec -it temp-network-configs-pod -- ls -larth /network-configs
# clean
kubectl delete pod temp-network-configs-pod
kubectl apply -f - <<EOF
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: validator-keys
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
EOF
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: temp-validator-keys-pod
spec:
containers:
- name: temp-container
image: busybox
command: ["sleep", "3600"]
volumeMounts:
- mountPath: /validator-keys
name: my-volume
securityContext:
fsGroup: 10001 # to be same group as the lighthouse container
volumes:
- name: my-volume
persistentVolumeClaim:
claimName: validator-keys
restartPolicy: Never
EOF
sleep 10
kubectl cp $CONFIG_DIRECTORY/validator-keys temp-validator-keys-pod:/
# check
kubectl exec -it temp-validator-keys-pod -- chmod -R 777 validator-keys # need to figure out permission later
kubectl exec -it temp-validator-keys-pod -- ls -larth /validator-keys
# clean
kubectl delete pod temp-validator-keys-pod