forked from intel/pmem-csi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpmem-app-block-volume.yaml
38 lines (38 loc) · 1.18 KB
/
pmem-app-block-volume.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
kind: Pod
apiVersion: v1
metadata:
name: my-csi-app
spec:
initContainers:
# This init container is a workaround for https://github.com/kubernetes/kubernetes/issues/85624.
- name: store-device
image: ubuntu
command:
- "sh"
- "-c"
- "(echo '#!/bin/sh' && stat -c 'mknod /dev-xpmem b 0x%t 0x%T' /dev-xpmem) >/data/create-dev.sh && chmod a+x /data/create-dev.sh"
volumeMounts:
- name: data
mountPath: /data
volumeDevices:
- name: my-csi-device
devicePath: /dev-xpmem
containers:
- name: my-frontend
image: ubuntu
securityContext:
privileged: True
command:
- "sh"
- "-c"
# mkfs.ext4 may fail here if the volume was already formatted before, so we ignore the return code.
- "if [ ! -e /dev-xpmem ]; then /data/create-dev.sh; fi && mkfs.ext4 -b 4096 /dev-xpmem; mkdir -p /mnt && mount -odax /dev-xpmem /mnt && mount | grep /mnt | grep dax && sleep 100000"
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: my-csi-device
persistentVolumeClaim:
claimName: pmem-csi-pvc-block-volume
- name: data
emptyDir: