diff --git a/deploy/prerequisite/longhorn-nvme-cli-installation.yaml b/deploy/prerequisite/longhorn-nvme-cli-installation.yaml new file mode 100644 index 0000000..60cca12 --- /dev/null +++ b/deploy/prerequisite/longhorn-nvme-cli-installation.yaml @@ -0,0 +1,36 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: longhorn-nvme-cli-installation + labels: + app: longhorn-nvme-cli-installation + annotations: + command: &cmd OS=$(grep -E "^ID_LIKE=" /etc/os-release | cut -d '=' -f 2); if [[ -z "${OS}" ]]; then OS=$(grep -E "^ID=" /etc/os-release | cut -d '=' -f 2); fi; if [[ "${OS}" == *"debian"* ]]; then sudo apt-get update -q -y && sudo apt-get install -q -y nvme-cli && sudo modprobe nvme-tcp; elif [[ "${OS}" == *"suse"* ]]; then sudo zypper --gpg-auto-import-keys -q refresh && sudo zypper --gpg-auto-import-keys -q install -y nvme-cli && sudo modprobe nvme-tcp; else sudo yum makecache -q -y && sudo yum --setopt=tsflags=noscripts install -q -y nvme-cli && sudo modprobe nvme-tcp; fi && if [ $? -eq 0 ]; then echo "nvme-cli install successfully"; else echo "nvme-cli install failed error code $?"; fi +spec: + selector: + matchLabels: + app: longhorn-nvme-cli-installation + template: + metadata: + labels: + app: longhorn-nvme-cli-installation + spec: + hostNetwork: true + hostPID: true + initContainers: + - name: nvme-cli-installation + command: + - nsenter + - --mount=/proc/1/ns/mnt + - -- + - bash + - -c + - *cmd + image: alpine:3.12 + securityContext: + privileged: true + containers: + - name: sleep + image: registry.k8s.io/pause:3.1 + updateStrategy: + type: RollingUpdate