Add iscsi installtion daemonset yaml file

Add iscsi installation yaml file to provide a convenient way to install
iscsi on every host.

Longhorn #1741

Signed-off-by: Bo Tao <bo.tao@rancher.com>
This commit is contained in:
Bo Tao 2020-10-30 22:13:28 -07:00 committed by Sheng Yang
parent a1754a0906
commit 250fd32066

View File

@ -0,0 +1,31 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: longhorn-iscsi-installation
labels:
app: longhorn-iscsi-installation
annotations:
command: &cmd OS=$(grep "ID_LIKE" /etc/os-release | cut -d '=' -f 2); if [[ $OS == *"debian"* ]]; then apt-get update -qy && apt-get install -qy open-iscsi && sudo systemctl enable iscsid && sudo systemctl start iscsid; else yum install iscsi-initiator-utils -y && sudo systemctl enable iscsid && sudo systemctl start iscsid; fi && if [ $? -eq 0 ]; then echo "iscsi install successfully"; else echo "iscsi install failed error code " $?; fi
spec:
selector:
matchLabels:
app: longhorn-iscsi-installation
template:
metadata:
labels:
app: longhorn-iscsi-installation
spec:
hostNetwork: true
containers:
- name: iscsi-installation
command:
- nsenter
- --mount=/proc/1/ns/mnt
- --
- sh
- -c
- *cmd
image: alpine:3.7
securityContext:
privileged: true
hostPID: true