From 6c34cef1ef286c72eb44ff8174ea90edb9e2d96f Mon Sep 17 00:00:00 2001 From: Bo Tao Date: Fri, 30 Oct 2020 22:13:28 -0700 Subject: [PATCH] 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 --- deploy/iscsi/longhorn-iscsi-installation.yaml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 deploy/iscsi/longhorn-iscsi-installation.yaml diff --git a/deploy/iscsi/longhorn-iscsi-installation.yaml b/deploy/iscsi/longhorn-iscsi-installation.yaml new file mode 100644 index 0000000..8e2a157 --- /dev/null +++ b/deploy/iscsi/longhorn-iscsi-installation.yaml @@ -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