enable azure disk mount on windows node

add initial work for mount azure file on windows

fix review comments

full implementation for attach azure file on windows node

working azure file mount

remove useless functions

add a workable implementation about mounting azure file on windows node

fix review comments and make the pod creating successful even azure file mount failed

fix according to review comments

add mount_windows_test

add implementation for IsLikelyNotMountPoint func

remove mount_windows_test.go temporaly

add back unit test for mount_windows.go

add normalizeWindowsPath func

fix normalizeWindowsPath func issue

implment azure disk on windows

update bazel BUILD

revert validation.go change as it's another PR

fix merge issue and compiling issue

fix windows compiling issue

fix according to review comments

fix according to review comments

fix cross-build failure

fix according to review comments

fix test build failure temporalily

fix darwin build failure

fix azure windows test failure

add empty implementation of MakeRShared on windows

fix gofmt errors
This commit is contained in:
xiazhang
2017-07-31 10:38:11 +08:00
committed by andyzhangx
parent a51eb2ac4e
commit 82c909cc99
16 changed files with 691 additions and 195 deletions

View File

@@ -19,6 +19,7 @@ package azure_file
import (
"fmt"
"os"
"runtime"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -210,15 +211,24 @@ func (b *azureFileMounter) SetUpAt(dir string, fsGroup *int64) error {
if accountName, accountKey, err = b.util.GetAzureCredentials(b.plugin.host, b.secretNamespace, b.secretName); err != nil {
return err
}
os.MkdirAll(dir, 0700)
source := fmt.Sprintf("//%s.file.%s/%s", accountName, getStorageEndpointSuffix(b.plugin.host.GetCloudProvider()), b.shareName)
// parameters suggested by https://azure.microsoft.com/en-us/documentation/articles/storage-how-to-use-files-linux/
options := []string{fmt.Sprintf("vers=3.0,username=%s,password=%s,dir_mode=0700,file_mode=0700", accountName, accountKey)}
if b.readOnly {
options = append(options, "ro")
mountOptions := []string{}
source := ""
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)
if runtime.GOOS == "windows" {
mountOptions = []string{accountName, accountKey}
} else {
os.MkdirAll(dir, 0700)
// parameters suggested by https://azure.microsoft.com/en-us/documentation/articles/storage-how-to-use-files-linux/
options := []string{fmt.Sprintf("vers=3.0,username=%s,password=%s,dir_mode=0700,file_mode=0700", accountName, accountKey)}
if b.readOnly {
options = append(options, "ro")
}
mountOptions = volume.JoinMountOptions(b.mountOptions, options)
}
mountOptions := volume.JoinMountOptions(b.mountOptions, options)
err = b.mounter.Mount(source, dir, "cifs", mountOptions)
if err != nil {
notMnt, mntErr := b.mounter.IsLikelyNotMountPoint(dir)