-
Notifications
You must be signed in to change notification settings - Fork 0
/
enableISCSI.yml
75 lines (75 loc) · 1.73 KB
/
enableISCSI.yml
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
apiVersion: v1
kind: Namespace
metadata:
name: iscsi-node
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: enable-iscsid-daemonset
namespace: iscsi-node
labels:
app: enable-iscsid
type: daemonset
spec:
selector:
matchLabels:
app: enable-iscsid
type: daemonset
template:
metadata:
labels:
app: enable-iscsid
type: daemonset
spec:
hostPID: true
containers:
- name: enable-iscsid-daemonset
image: debian
volumeMounts:
- name: systemd-config-volume
mountPath: /mnt/
- mountPath: /host
name: noderoot
securityContext:
privileged: true
command: ["/bin/sh", "-c", "--"]
args: ["while true; do /mnt/watchdog.sh; done;"]
volumes:
- name: systemd-config-volume
configMap:
defaultMode: 0755
name: systemd-server-conf
- name: systemd-storage-volume
emptyDir: {}
- name: noderoot
hostPath:
path: /
---
apiVersion: v1
kind: ConfigMap
metadata:
name: systemd-server-conf
namespace: iscsi-node
labels:
name: systemd-server-conf
data:
watchdog.sh: |-
#!/bin/sh
chroot /host /usr/bin/sh <<"EOT"
if ! /usr/bin/systemctl is-active --quiet iscsid
then
echo "Start Serice"
/usr/bin/systemctl start iscsid
else
echo "Service already "$(/usr/bin/systemctl is-active iscsid)
fi
if ! /usr/bin/systemctl is-enabled --quiet iscsid
then
echo "Enable Service"
/usr/bin/systemctl enable iscsid &> /dev/null
else
echo "Service already "$(/usr/bin/systemctl is-enabled iscsid)
fi
EOT
sleep 60