From 6584df59145b948d56704a504b1bef2cf9ced8fc Mon Sep 17 00:00:00 2001 From: Florent BENOIT Date: Fri, 14 Sep 2018 10:39:30 +0200 Subject: [PATCH] if driver disable support of FSGroup, mounter will not process the volume ownership --- pkg/volume/flexvolume/driver-call.go | 2 ++ pkg/volume/flexvolume/mounter.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/volume/flexvolume/driver-call.go b/pkg/volume/flexvolume/driver-call.go index 00d7efbbc1..bd5a5cdb4f 100644 --- a/pkg/volume/flexvolume/driver-call.go +++ b/pkg/volume/flexvolume/driver-call.go @@ -223,6 +223,7 @@ type DriverCapabilities struct { Attach bool `json:"attach"` SELinuxRelabel bool `json:"selinuxRelabel"` SupportsMetrics bool `json:"supportsMetrics"` + FSGroup bool `json:"fsGroup"` } func defaultCapabilities() *DriverCapabilities { @@ -230,6 +231,7 @@ func defaultCapabilities() *DriverCapabilities { Attach: true, SELinuxRelabel: true, SupportsMetrics: false, + FSGroup: true, } } diff --git a/pkg/volume/flexvolume/mounter.go b/pkg/volume/flexvolume/mounter.go index 4405d12add..8c246043cb 100644 --- a/pkg/volume/flexvolume/mounter.go +++ b/pkg/volume/flexvolume/mounter.go @@ -92,7 +92,9 @@ func (f *flexVolumeMounter) SetUpAt(dir string, fsGroup *int64) error { } if !f.readOnly { - volume.SetVolumeOwnership(f, fsGroup) + if f.plugin.capabilities.FSGroup { + volume.SetVolumeOwnership(f, fsGroup) + } } return nil