From 080d2dfe8f1e3cf6bad8ef2c5fecbe695ee9d90a Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Thu, 17 May 2018 13:48:45 +0200 Subject: [PATCH] Add SELinux support to CSI --- pkg/volume/csi/csi_mounter.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/volume/csi/csi_mounter.go b/pkg/volume/csi/csi_mounter.go index 812b7de72e2..53908c76b93 100644 --- a/pkg/volume/csi/csi_mounter.go +++ b/pkg/volume/csi/csi_mounter.go @@ -252,10 +252,18 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error { } func (c *csiMountMgr) GetAttributes() volume.Attributes { + mounter := c.plugin.host.GetMounter(c.plugin.GetPluginName()) + path := c.GetPath() + supportSelinux, err := mounter.GetSELinuxSupport(path) + if err != nil { + glog.V(2).Info(log("error checking for SELinux support: %s", err)) + // Best guess + supportSelinux = false + } return volume.Attributes{ ReadOnly: c.readOnly, Managed: !c.readOnly, - SupportsSELinux: false, + SupportsSELinux: supportSelinux, } }