mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Prevent AzureFile from logging senstive options
This commit is contained in:
parent
727582311f
commit
548b297a00
@ -272,18 +272,20 @@ func (b *azureFileMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs) e
|
|||||||
}
|
}
|
||||||
|
|
||||||
var mountOptions []string
|
var mountOptions []string
|
||||||
|
var sensitiveMountOptions []string
|
||||||
source := ""
|
source := ""
|
||||||
osSeparator := string(os.PathSeparator)
|
osSeparator := string(os.PathSeparator)
|
||||||
source = fmt.Sprintf("%s%s%s.file.%s%s%s", osSeparator, osSeparator, accountName, getStorageEndpointSuffix(b.plugin.host.GetCloudProvider()), osSeparator, b.shareName)
|
source = fmt.Sprintf("%s%s%s.file.%s%s%s", osSeparator, osSeparator, accountName, getStorageEndpointSuffix(b.plugin.host.GetCloudProvider()), osSeparator, b.shareName)
|
||||||
|
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
mountOptions = []string{fmt.Sprintf("AZURE\\%s", accountName), accountKey}
|
sensitiveMountOptions = []string{fmt.Sprintf("AZURE\\%s", accountName), accountKey}
|
||||||
} else {
|
} else {
|
||||||
if err := os.MkdirAll(dir, 0700); err != nil {
|
if err := os.MkdirAll(dir, 0700); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// parameters suggested by https://azure.microsoft.com/en-us/documentation/articles/storage-how-to-use-files-linux/
|
// parameters suggested by https://azure.microsoft.com/en-us/documentation/articles/storage-how-to-use-files-linux/
|
||||||
options := []string{fmt.Sprintf("username=%s,password=%s", accountName, accountKey)}
|
options := []string{}
|
||||||
|
sensitiveMountOptions = []string{fmt.Sprintf("username=%s,password=%s", accountName, accountKey)}
|
||||||
if b.readOnly {
|
if b.readOnly {
|
||||||
options = append(options, "ro")
|
options = append(options, "ro")
|
||||||
}
|
}
|
||||||
@ -293,7 +295,7 @@ func (b *azureFileMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs) e
|
|||||||
|
|
||||||
mountComplete := false
|
mountComplete := false
|
||||||
err = wait.Poll(5*time.Second, 10*time.Minute, func() (bool, error) {
|
err = wait.Poll(5*time.Second, 10*time.Minute, func() (bool, error) {
|
||||||
err := b.mounter.Mount(source, dir, "cifs", mountOptions)
|
err := b.mounter.MountSensitive(source, dir, "cifs", mountOptions, sensitiveMountOptions)
|
||||||
mountComplete = true
|
mountComplete = true
|
||||||
return true, err
|
return true, err
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user