From 3abb453bd0e540a653054742f653ec1b4484cf3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=88=8D=E6=88=91=E5=85=B6=E8=B0=81?= Date: Mon, 30 Jan 2023 22:32:07 +0800 Subject: [PATCH] volume: Add the missing option propagation_mode (#15626) --- .changelog/15626.txt | 3 +++ client/allocrunner/taskrunner/volume_hook.go | 14 ++++++++------ .../docs/job-specification/volume_mount.mdx | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 .changelog/15626.txt diff --git a/.changelog/15626.txt b/.changelog/15626.txt new file mode 100644 index 000000000..2eecd7f91 --- /dev/null +++ b/.changelog/15626.txt @@ -0,0 +1,3 @@ +```release-note:bug +fix: Add the missing option propagation_mode for volume_mount +``` diff --git a/client/allocrunner/taskrunner/volume_hook.go b/client/allocrunner/taskrunner/volume_hook.go index 7aeab512d..54819e3ea 100644 --- a/client/allocrunner/taskrunner/volume_hook.go +++ b/client/allocrunner/taskrunner/volume_hook.go @@ -88,9 +88,10 @@ func (h *volumeHook) hostVolumeMountConfigurations(taskMounts []*structs.VolumeM } mcfg := &drivers.MountConfig{ - HostPath: hostVolume.Path, - TaskPath: m.Destination, - Readonly: hostVolume.ReadOnly || req.ReadOnly || m.ReadOnly, + HostPath: hostVolume.Path, + TaskPath: m.Destination, + Readonly: hostVolume.ReadOnly || req.ReadOnly || m.ReadOnly, + PropagationMode: m.PropagationMode, } mounts = append(mounts, mcfg) } @@ -180,9 +181,10 @@ func (h *volumeHook) prepareCSIVolumes(req *interfaces.TaskPrestartRequest, volu for _, m := range mountsForAlias { mcfg := &drivers.MountConfig{ - HostPath: csiMountPoint.Source, - TaskPath: m.Destination, - Readonly: request.ReadOnly || m.ReadOnly, + HostPath: csiMountPoint.Source, + TaskPath: m.Destination, + Readonly: request.ReadOnly || m.ReadOnly, + PropagationMode: m.PropagationMode, } mounts = append(mounts, mcfg) } diff --git a/website/content/docs/job-specification/volume_mount.mdx b/website/content/docs/job-specification/volume_mount.mdx index 97e424f8e..078a33bac 100644 --- a/website/content/docs/job-specification/volume_mount.mdx +++ b/website/content/docs/job-specification/volume_mount.mdx @@ -26,6 +26,7 @@ job "docs" { volume_mount { volume = "certs" destination = "/etc/ssl/certs" + propagation_mode = "private" } } }