longhorn/deploy/prerequisite/longhorn-spdk-setup.yaml
Derek Su 3a44ec93c9 spdk: reduce hugepage size to 1024MiB and persistent the hugepage setting
Signed-off-by: Derek Su <derek.su@suse.com>
2023-06-01 23:23:05 +08:00

48 lines
1.3 KiB
YAML

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 "vm.nr_hugepages=$((HUGEMEM/2))" >> /etc/sysctl.conf; 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: PCI_ALLOWED
value: "none"
- name: DRIVER_OVERRIDE
value: "uio_pci_generic"
securityContext:
privileged: true
containers:
- name: sleep
image: registry.k8s.io/pause:3.1
updateStrategy:
type: RollingUpdate