From 9a0883e8f26e1ee2030fc0b4d2d056dc8de8c1b5 Mon Sep 17 00:00:00 2001 From: Derek Su Date: Mon, 8 May 2023 23:34:28 +0800 Subject: [PATCH] prerequisite: add spdk environment setup manifest Longhorn 5738 Signed-off-by: Derek Su --- deploy/prerequisite/longhorn-spdk-setup.yaml | 45 ++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 deploy/prerequisite/longhorn-spdk-setup.yaml diff --git a/deploy/prerequisite/longhorn-spdk-setup.yaml b/deploy/prerequisite/longhorn-spdk-setup.yaml new file mode 100644 index 0000000..29d8983 --- /dev/null +++ b/deploy/prerequisite/longhorn-spdk-setup.yaml @@ -0,0 +1,45 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: longhorn-spdk-setup + labels: + app: longhorn-spdk-setup + annotations: + command: &cmd rm -rf ${SPDK_DIR}; git clone -b longhorn https://github.com/longhorn/spdk.git ${SPDK_DIR} && bash ${SPDK_DIR}/scripts/setup.sh ${SPDK_OPTION}; if [ $? -eq 0 ]; then echo "SPDK environment is configured successfully"; else echo "Failed to configure SPDK environment error code $?"; fi; rm -rf ${SPDK_DIR} +spec: + selector: + matchLabels: + app: longhorn-spdk-setup + template: + metadata: + labels: + app: longhorn-spdk-setup + spec: + hostNetwork: true + hostPID: true + initContainers: + - name: longhorn-spdk-setup + command: + - nsenter + - --mount=/proc/1/ns/mnt + - -- + - bash + - -c + - *cmd + image: alpine:3.12 + env: + - name: SPDK_DIR + value: /tmp/spdk + - name: SPDK_OPTION + value: "" + - name: HUGEMEM + value: "2048" + - name: DRIVER_OVERRIDE + value: "uio_pci_generic" + securityContext: + privileged: true + containers: + - name: sleep + image: registry.k8s.io/pause:3.1 + updateStrategy: + type: RollingUpdate