-
Notifications
You must be signed in to change notification settings - Fork 132
/
Copy pathkubevirt-local-mounter.yaml
43 lines (41 loc) · 1.19 KB
/
kubevirt-local-mounter.yaml
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
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: create-bind-mounts
namespace: kube-system
spec:
selector:
matchLabels:
app: create-bind-mounts
template:
metadata:
labels:
app: create-bind-mounts
spec:
hostPID: true
containers:
- name: startup-script
image: quay.io/kubermatic/startup-script:v0.1.0
securityContext:
privileged: true
env:
- name: STARTUP_SCRIPT
value: |
for ((i=1;i<=50;i++));
do
mkdir -p /opt/kube-disks/${i} /mnt/local-volumes/${i}
cat >/etc/systemd/system/mnt-local\\x2dvolumes-${i}.mount <<EOL
[Unit]
DefaultDependencies=no
Before=local-fs.target umount.target
[Mount]
What=/opt/kube-disks/${i}
Where=/mnt/local-volumes/${i}
Type=none
Options=bind
[Install]
WantedBy=local-fs.target
EOL
systemctl daemon-reload
systemctl enable --now "mnt-local\x2dvolumes-${i}.mount"
done