From 3448143d065bddac239a41591be6f4c31776c89d Mon Sep 17 00:00:00 2001 From: Eric Weber Date: Thu, 16 Jun 2022 17:00:01 -0500 Subject: [PATCH] Avoid requiring CSI plugins to be redeployed after introducing StagePublishDir --- .../allocrunner/taskrunner/plugin_supervisor_hook.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/allocrunner/taskrunner/plugin_supervisor_hook.go b/client/allocrunner/taskrunner/plugin_supervisor_hook.go index b182f4f9d05..7346b4e02fc 100644 --- a/client/allocrunner/taskrunner/plugin_supervisor_hook.go +++ b/client/allocrunner/taskrunner/plugin_supervisor_hook.go @@ -103,6 +103,16 @@ func newCSIPluginSupervisorHook(config *csiPluginSupervisorHookConfig) *csiPlugi socketMountPoint := filepath.Join(config.clientStateDirPath, "csi", "plugins", config.runner.Alloc().ID) + // In v1.3.0, Nomad started instructing CSI plugins to stage and publish + // within /csi/local. Plugins deployed after the introduction of + // StagePublishDir default to StagePublishDir = /csi/local. However, + // plugins deployed between v1.3.0 and the introduction of + // StagePublishDir have StagePublishDir = "". Default to /csi/local here + // to avoid breaking plugins that aren't redeployed. + if task.CSIPluginConfig.StagePublishDir == "" { + task.CSIPluginConfig.StagePublishDir = filepath.Join("/local", "csi") + } + if task.CSIPluginConfig.HealthTimeout == 0 { task.CSIPluginConfig.HealthTimeout = 30 * time.Second }