kubernetes/pkg/util/mount
Kubernetes Submit Queue 17ba22aa85 Merge pull request #52469 from andyzhangx/azurefile-mount-windows
Automatic merge from submit-queue (batch tested with PRs 52469, 52574, 52330, 52689, 52829). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>..

add feature: azurefile mount on windows node

**What this PR does / why we need it**:
feature: azurefile mount on windows node. I created this new PR, close the original one(https://github.com/kubernetes/kubernetes/pull/50233) as there is a big rebase change.
Currently only SMB(a nfs protocol) is supported for windows container in the new Windows 2016 RS3 image, and windows container in RS3 could only use New-SmbGlobalMapping cmdlet for volume mapping, "net use" command does not work for windows container.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:
As there is a known blocking issue in Windows 2016 server when mounting a SMB(a NFS protocol in Windows) share on a container host and then bind that share to a container ( Azure file on Windows is using SMB protocol), this PR still could not mount an azure file on current windows 2016 server node, it depends on 2016 RS3 release, and it will still succeed (as a workaround) if customer want to mount an azure file on current windows node.


Main code logic is similar to what it does in Linux node:

1. create target directory in Windows host
2. Use New-SmbGlobalMapping powershell cmdlet to mount SMB azure file to a drive in Windows host
3. Use mklink command to link target directory to the mounted drive

K8s would bind target directory to the container directory
source in mount function would be like:
`\\[accountname].file.core.windows.net\test`

target in mount function would be like:
`c:\var\lib\kubelet\pods\5f679f75-7ce3-11e7-b718-000d3a31dac4\volumes\kubernetes.io~azure-file`

sample azure file config file:
```
apiVersion: v1
kind: Pod
metadata:
 name: iis
spec:
 containers:
  - image: microsoft/iis
    name: iis
    volumeMounts:
      - name: azure
        mountPath: "d:"
 nodeSelector:
   beta.kubernetes.io/os: windows
 volumes:
      - name: azure
        azureFile:
          secretName: azure-secret
          shareName: k8stest
          readOnly: false
```

**Release note**:

```release-note
```
2017-09-23 21:52:46 -07:00
..
BUILD enable azure disk mount on windows node 2017-09-12 01:52:48 +00:00
doc.go Use Go canonical import paths 2016-07-16 13:48:21 -04:00
exec.go Add Exec interface to VolumeHost 2017-08-14 12:16:25 +02:00
fake.go Share /var/lib/kubernetes on startup 2017-08-30 16:45:04 +02:00
mount_linux_test.go Share /var/lib/kubernetes on startup 2017-08-30 16:45:04 +02:00
mount_linux.go Merge pull request #51518 from jianglingxia/jlx8291910 2017-09-22 23:35:59 -07:00
mount_unsupported.go Merge pull request #50503 from karataliu/mount_clean 2017-09-22 23:35:54 -07:00
mount_windows_test.go enable azure disk mount on windows node 2017-09-12 01:52:48 +00:00
mount_windows.go only allow cifs mount on windows node 2017-09-20 14:14:54 +00:00
mount.go enable azure disk mount on windows node 2017-09-12 01:52:48 +00:00
nsenter_mount_test.go Fix findmnt parsing in containerized kubelet 2017-07-18 13:35:44 +02:00
nsenter_mount_unsupported.go Share /var/lib/kubernetes on startup 2017-08-30 16:45:04 +02:00
nsenter_mount.go Share /var/lib/kubernetes on startup 2017-08-30 16:45:04 +02:00
OWNERS Add owner file in /pkg/util/mount package 2017-02-06 10:51:26 -08:00
safe_format_and_mount_test.go SafeFormatAndMount should use volume.Exec provided by VolumeHost 2017-08-14 12:16:27 +02:00