From dec0d4c11d19122fa0e1c96f3417d6716cf8823e Mon Sep 17 00:00:00 2001 From: Derek Su Date: Sat, 6 May 2023 14:01:00 +0800 Subject: [PATCH] prerequisite: add nvme-cli installation manifest Longhorn 5738 Signed-off-by: Derek Su --- .../longhorn-nvme-cli-installation.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 deploy/prerequisite/longhorn-nvme-cli-installation.yaml 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