set fsGroup by securityContext.fsGroup in azure file
fix comments fix comments fix comments
This commit is contained in:
@@ -29,6 +29,7 @@ import (
|
||||
const (
|
||||
fileMode = "file_mode"
|
||||
dirMode = "dir_mode"
|
||||
gid = "gid"
|
||||
vers = "vers"
|
||||
defaultFileMode = "0755"
|
||||
defaultDirMode = "0755"
|
||||
@@ -95,11 +96,12 @@ func (s *azureSvc) SetAzureCredentials(host volume.VolumeHost, nameSpace, accoun
|
||||
return secretName, err
|
||||
}
|
||||
|
||||
// check whether mountOptions contain file_mode and dir_mode, if not, append default mode
|
||||
func appendDefaultMountOptions(mountOptions []string) []string {
|
||||
// check whether mountOptions contain file_mode, dir_mode, vers, gid, if not, append default mode
|
||||
func appendDefaultMountOptions(mountOptions []string, fsGroup *int64) []string {
|
||||
fileModeFlag := false
|
||||
dirModeFlag := false
|
||||
versFlag := false
|
||||
gidFlag := false
|
||||
|
||||
for _, mountOption := range mountOptions {
|
||||
if strings.HasPrefix(mountOption, fileMode) {
|
||||
@@ -111,6 +113,9 @@ func appendDefaultMountOptions(mountOptions []string) []string {
|
||||
if strings.HasPrefix(mountOption, vers) {
|
||||
versFlag = true
|
||||
}
|
||||
if strings.HasPrefix(mountOption, gid) {
|
||||
gidFlag = true
|
||||
}
|
||||
}
|
||||
|
||||
allMountOptions := mountOptions
|
||||
@@ -125,5 +130,9 @@ func appendDefaultMountOptions(mountOptions []string) []string {
|
||||
if !versFlag {
|
||||
allMountOptions = append(allMountOptions, fmt.Sprintf("%s=%s", vers, defaultVers))
|
||||
}
|
||||
|
||||
if !gidFlag && fsGroup != nil {
|
||||
allMountOptions = append(allMountOptions, fmt.Sprintf("%s=%d", gid, *fsGroup))
|
||||
}
|
||||
return allMountOptions
|
||||
}
|
||||
|
Reference in New Issue
Block a user