Skip to content

Commit d699be7

Browse files
committed
Make provisioner root persistent across reboot
If the proversioner container or the host restart data dir under /tmp in the container will be lost thus causing start up failure for any pods using csi pv. It's good to make the provisioner root persistent so that this plugin is more reliable for daily testing.
1 parent b862d4c commit d699be7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

deploy/hostpath/csi-hostpath-plugin.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ spec:
6060
name: socket-dir
6161
- mountPath: /registration
6262
name: registration-dir
63+
- mountPath: /csi-data-dir
64+
name: csi-data-dir
6365

6466
- name: hostpath
6567
image: quay.io/k8scsi/hostpathplugin:v1.0.1
@@ -104,3 +106,8 @@ spec:
104106
path: /var/lib/kubelet/plugins
105107
type: Directory
106108
name: plugins-dir
109+
# 'path' is where PV data is persisted on host.
110+
# using /tmp is also possible while the PVs will not available after plugin container recreation or host reboot
111+
path: /var/lib/csi-hostpath-data/
112+
type: DirectoryOrCreate
113+
name: csi-data-dir

pkg/hostpath/controllerserver.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ import (
3838

3939
const (
4040
deviceID = "deviceID"
41-
provisionRoot = "/tmp/"
42-
snapshotRoot = "/tmp/"
41+
provisionRoot = "/csi-data-dir"
42+
snapshotRoot = "/csi-data-dir"
4343
maxStorageCapacity = tib
4444
)
4545

0 commit comments

Comments
 (0)