Commit Graph

158 Commits (efa63b7a5877252a3e542bc866cd0fe637933aed)

Author SHA1 Message Date
Jeff Grafton ef56a8d6bb Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
Kubernetes Submit Queue f2b6e49e6c
Merge pull request #58433 from yue9944882/bugfix/lstat-parent-with-abs-path
Automatic merge from submit-queue (batch tested with PRs 59103, 58433). 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>.

bugfix(mount): lstat with abs path of parent instead of '/..'

**What this PR does / why we need it**:

If a nfs volume with improper permission is mounted on a Pod, operation of deleting this Pod will fail and the pod itself will be stuck at a 'TERMINATING' status. Kubelet cannot reconcile it correctly.

This is because kubelet will try to find the mount-point with '..' file which needs `x` permission of dir.  When it's forbidden, the nfs volume will never umount without a correct mount-point finded.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Get parent dir via canonical absolute path when trying to judge mount-point
```
2018-02-14 03:55:34 -08:00
Kubernetes Submit Queue 2cd6cd6e86
Merge pull request #59818 from msau42/owners
Automatic merge from submit-queue. 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 reviewers to util/mount

**What this PR does / why we need it**:
Add some more reviewers

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-02-13 11:13:04 -08:00
Michelle Au 377bff614d add reviewers to util/mount 2018-02-13 10:06:27 -08:00
Kubernetes Submit Queue 317853c90c
Merge pull request #59464 from dixudx/fix_all_typos
Automatic merge from submit-queue. 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>.

fix all the typos across the project

**What this PR does / why we need it**:
There are lots of typos across the project. We should avoid small PRs on fixing those annoying typos, which is time-consuming and low efficient.

This PR does fix all the typos across the project currently. And with #59463, typos could be avoided when a new PR gets merged.

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

**Special notes for your reviewer**:
/sig testing
/area test-infra
/sig release
/cc @ixdy 
/assign @fejta 

**Release note**:

```release-note
None
```
2018-02-10 22:12:45 -08:00
Di Xu 48388fec7e fix all the typos across the project 2018-02-11 11:04:14 +08:00
Kubernetes Submit Queue 28b4bb0fd6
Merge pull request #59540 from andyzhangx/azurefile-windows-fix
Automatic merge from submit-queue. 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>.

return error if New-SmbGlobalMapping failed when mounting azure file on Windows

**What this PR does / why we need it**:
This PR will return error if New-SmbGlobalMapping failed when mounting azure file on Windows.
User wants to create a pod moutning with azure file pvc using static provisioning([doc](https://github.com/andyzhangx/Demo/tree/master/windows/azurefile#static-provisioning-for-azure-file-on-windows-server-version-1709support-from-v17x])) and user uses a wrong storage account name or key, current behavior is if mount azure file on Windows, it will create an empty directory, and user would not know actually it fails.

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

**Special notes for your reviewer**:

**Release note**:

```
return error if New-SmbGlobalMapping failed when mounting azure file on Windows
```
2018-02-09 23:21:53 -08:00
Kubernetes Submit Queue 3ee818c259
Merge pull request #58912 from mlmhl/volume_mount
Automatic merge from submit-queue (batch tested with PRs 59466, 58912, 59605, 59548). 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>.

return a more human readable error message if mount an unformatted vo…

**What this PR does / why we need it**:

If an unformatted volume is requested as read only mode, according device mount operation will fail, and the message is verbose and obscure. We should check this scenario and return a more human readable message.

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

**Release note**:

```release-note
NONE
```

/sig storage
2018-02-09 03:44:35 -08:00
Kubernetes Submit Queue d6625f857a
Merge pull request #58177 from jingxu97/Jan/reconstruct
Automatic merge from submit-queue. 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>.

Redesign and implement volume reconstruction work

This PR is the first part of redesign of volume reconstruction work. The detailed design information is https://github.com/kubernetes/community/pull/1601

The changes include
1. Remove dependency on volume spec stored in actual state for volume
cleanup process (UnmountVolume and UnmountDevice)

Modify AttachedVolume struct to add DeviceMountPath so that volume
unmount operation can use this information instead of constructing from
volume spec

2. Modify reconciler's volume reconstruction process (syncState). Currently workflow
is when kubelet restarts, syncState() is only called once before
reconciler starts its loop.
a. If volume plugin supports reconstruction, it will use the
reconstructed volume spec information to update actual state as before.
b. If volume plugin cannot support reconstruction, it will use the
scanned mount path information to clean up the mounts.

In this PR, all the plugins still support reconstruction (except
glusterfs), so reconstruction of some plugins will still have issues.
The next PR will modify those plugins that cannot support reconstruction
well.

This PR addresses issue #52683
2018-02-08 18:21:34 -08:00
mlmhl 2f46df3540 return a more human readable error message if mount an unformatted volume as readonly 2018-02-08 20:01:41 +08:00
andyzhangx 0a63d7cc9a return error if New-SmbGlobalMapping failed in azure file mount 2018-02-08 05:56:16 +00:00
Jing Xu 9588d2098a Redesign and implement volume reconstruction work
This PR is the first part of redesign of volume reconstruction work. The
changes include
1. Remove dependency on volume spec stored in actual state for volume
cleanup process (UnmountVolume and UnmountDevice)

Modify AttachedVolume struct to add DeviceMountPath so that volume
unmount operation can use this information instead of constructing from
volume spec

2. Modify reconciler's volume reconstruction process (syncState). Currently workflow
is when kubelet restarts, syncState() is only called once before
reconciler starts its loop.
a. If volume plugin supports reconstruction, it will use the
reconstructed volume spec information to update actual state as before.
b. If volume plugin cannot support reconstruction, it will use the
scanned mount path information to clean up the mounts.

In this PR, all the plugins still support reconstruction (except
glusterfs), so reconstruction of some plugins will still have issues.
The next PR will modify those plugins that cannot support reconstruction
well.

This PR addresses issue #52683, #54108 (This PR includes the changes to
update devicePath after local attach finishes)
2018-02-05 13:14:09 -08:00
Yecheng Fu 322c094841 Use `blkid` to get fs type of device.
For `blkid`, if the specified token (TYPE/PTTYPE, etc) was
not found, or no (specified) devices could be identified, an
exit code of 2 is returned.
2018-02-05 11:21:35 +08:00
Yecheng Fu 5136938ff6 Use `blkid` to get fs type of device.
If a parition table type is detected, returns a special non-empty string
as filesystem type.
2018-02-03 00:24:21 +08:00
Yecheng Fu 75359c0b94 Use `blkid` to get fs type of device.
`lsblk` reads fs type info from udev files. If udev rules are not
installed. `lsblk` could not get correct fs type. This will cause
problems, e.g. expanding volume depends on fs type of disk.
2018-01-31 13:33:15 +08:00
yue9944882 c3982691ac bugfix(mount): lstat with abs path of parent instead of '/..' 2018-01-21 23:08:01 +08:00
Kubernetes Submit Queue 6369a10004
Merge pull request #58284 from mfojtik/findmnt-out
Automatic merge from submit-queue (batch tested with PRs 57868, 58284, 56370, 58400, 58439). 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>.

Show findmnt command output in case of error

**What this PR does / why we need it**:

We don't print the error output from the `findmnt` command, which makes it pretty hard to debug. 

The current implementation just print:

`
I0115 11:59:36.078285   18230 nsenter_mount.go:168] Failed findmnt command for path /var/lib/origin/openshift.local.volumes/pods/8d723ec8-f9e9-11e7-bc52-025000000001/volumes/kubernetes.io~secret/pvinstaller-token-bxh42: exit status 1
`

With this patch, we can actually see the error:

`
I0115 12:04:30.908164   23301 nsenter_mount.go:168] Failed findmnt command for path /var/lib/origin/openshift.local.volumes/pods/8ff8bb98-f9e9-11e7-bc52-025000000001/volumes/kubernetes.io~secret/deployer-token-g4sg9: nsenter: failed to execute /findmnt: No such file or directory
 exit status 1
`

**Release note**:
```release-note
NONE
```
2018-01-18 13:11:30 -08:00
Kubernetes Submit Queue 74f2305c4f
Merge pull request #57967 from jsafrane/fix-nfs-root-squash
Automatic merge from submit-queue. 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>.

Fixed TearDown of NFS with root squash.

NFS plugin should not use `IsLikelyNotMountPoint()`, as it uses `lstat()` / `stat()` to determine if the NFS volume is still mounted - NFS server may use root_squash and kubelet may not be allowed to do `lstat()` / `stat()` there.

It must use slower `IsNotMountPoint()` instead, including in `TearDown()` function.

**Release note**:

```release-note
NONE
```

/assign @gnufied @rootfs
2018-01-17 13:32:03 -08:00
Michal Fojtik fd520aef61
Show findmt command output in case of error 2018-01-15 13:02:31 +01:00
Jan Safranek da1eec2853 Add jsafrane as util/mount approver. 2018-01-08 14:19:22 +01:00
Jan Safranek 45d21ee36b Fixed TearDown of NFS with root squash.
NFS plugin should not use IsLikelyNotMountPoint(), as it uses lstat() / stat()
to determine if the NFS volume is still mounted - NFS server may use
root_squash and kubelet may not be allowed to do lstat() / stat() there.

It must use slower IsNotMountPoint() instead, including TearDown() function.
2018-01-08 14:01:33 +01:00
Jeff Grafton efee0704c6 Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
Hemant Kumar 2f2a643684 Implement file system resizing support on kubelet start
Update bazel files
Fix operation executor tests
2017-11-22 16:06:10 -05:00
Jan Safranek 790f513d23 Fix cross-compliation of mount_exec.go
Add dummy implementation for non-linux platforms
2017-11-14 16:30:00 +01:00
Jan Safranek 1dd32ce7eb Add ExecMounter 2017-11-10 13:14:40 +01:00
Clayton Coleman b844ac44f5
Tmpdir can be a symlink, also fake mount needs to call nested mounter 2017-11-03 22:21:29 -04:00
Kubernetes Submit Queue 618b705a4b
Merge pull request #53629 from andyzhangx/azurefile-improve
Automatic merge from submit-queue (batch tested with PRs 46341, 53629). 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>.

fix azure file mount limit issue on windows due to using drive letter

**What this PR does / why we need it**:
It's not necessary to use drive letter in azure file mount, correct usage for New-SmbGlobalMapping is like following:
```
New-SmbGlobalMapping -RemotePath $AzureFilePath -Credential $Credential
mklink /D $mountPath $AzureFilePath 
```
I removed the `LocalPath` parameter in New-SmbGlobalMapping

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #54668
Without this PR, there is a limit(25) for azure file mount number on each node because only 25 drive letters could be used on each windows node, With this PR, there would be no such limit.

**Special notes for your reviewer**:
@PatrickLang 

**Release note**:

```
fix azure file mount limit issue on windows due to using drive letter
```
/sig azure
/sig windows
2017-11-01 04:38:12 -07:00
Kubernetes Submit Queue f34a24e98e
Merge pull request #52401 from andyzhangx/azuredisk-getdevfunc
Automatic merge from submit-queue. 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>.

fix warning messages due to GetMountRefs func not implemented in windows

**What this PR does / why we need it**:
This PR completes the windows implementation of GetMountRefs in mount.go. In linux, the GetMountRefs implementaion is: read `/proc/mounts` and find all mount points, while in Windows, there is no such `/proc/mounts` place which shows all mounting points. 
There is another way in windows, **we could walk through(by `getAllParentLinks` func) the mount path(symbolic link) and get all symlinks until we got the final device, which is actually a drive**.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #54670
This PR fixed the warnning issue mentioned in https://github.com/kubernetes/kubernetes/pull/51252

**Special notes for your reviewer**:
Some values in the code would be like follwoing:
```
GetMountRefs: mountPath ("\\var\\lib\\kubelet\\pods/4c74b128-92ca-11e7-b86b-000d3a36d70c/volumes/kubernetes.io~azure-disk/pvc-1cc91c70-92ca-11e7-b86b-000d3a36d70c")
getAllParentLinks: refs (["" "" "c:\\var\\lib\\kubelet\\plugins\\kubernetes.io\\azure-disk\\mounts\\b1246717734" "G:\\"])
basemountPath c:\var\lib\kubelet\plugins\kubernetes.io\azure-disk\mounts
got volumeID b1246717734
```

**Release note**:

```
fix warning messages due to GetMountRefs func not implemented in windows
```
2017-10-27 20:28:36 -07:00
Yecheng Fu a768092f9a RBD Plugin: Prepare to implement Attacher/Detacher interfaces.
1) Fix FakeMounter.IsLikelyNotMountPoint to return ErrNotExist if the
   directory does not exist. Mounter.IsLikelyNotMountPoint interface
   requires this, and RBD plugin depends on it.
2017-10-25 17:07:27 +08:00
andyzhangx 286d8ae287 add windows implementation of GetMountRefs
add unit test and fix according to comments

fix unit test issue

add const in getAllParentLinks func
2017-10-17 07:35:18 +00:00
Jeff Grafton aee5f457db update BUILD files 2017-10-15 18:18:13 -07:00
andyzhangx c9070ffa8c remove getAvailableDriveLetter func and test 2017-10-10 04:50:52 +00:00
andyzhangx 5275598d35 not necessary to use disk letter in azure file mount 2017-10-10 03:30:26 +00:00
Di Xu 542bd17e36 auto-gen 2017-09-26 09:57:13 +08:00
Di Xu 57ead4898b use GetFileType per mount.Interface to check hostpath type 2017-09-26 09:57:06 +08:00
Di Xu 46b0b3491f refactor nsenter to new pkg/util 2017-09-26 09:56:44 +08:00
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
Kubernetes Submit Queue 7d9eb60837 Merge pull request #51518 from jianglingxia/jlx8291910
Automatic merge from submit-queue (batch tested with PRs 43016, 50503, 51281, 51518, 51582). 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>..

double const in mount_linux.go

**What this PR does / why we need it**:
fix some typo and double const
**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**:

**Release note**:

```release-note
NONE
```
2017-09-22 23:35:59 -07:00
Kubernetes Submit Queue 980a8e6367 Merge pull request #50503 from karataliu/mount_clean
Automatic merge from submit-queue (batch tested with PRs 43016, 50503, 51281, 51518, 51582). 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>..

Clean up diskLooksUnformatted literal

**What this PR does / why we need it**:
#16948 moved the `formatAndMount` function to mount_linux.go, but `diskLooksUnformatted` does not necessarily need to appear in mount_unsupported.go
#31515 Renames `diskLooksUnformatted` to `getDiskFormat`, but did not update the comment

This is to do the small cleanup.

**Which issue this PR fixes**

**Special notes for your reviewer**:

**Release note**:
2017-09-22 23:35:54 -07:00
andyzhangx 98487a0cde only allow cifs mount on windows node 2017-09-20 14:14:54 +00:00
andyzhangx faffe82df7 add feature: azurefile mount on windows node
fix according to review comments

add comments for SMB mount support on Windows
2017-09-20 07:15:25 +00:00
xiazhang 82c909cc99 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
2017-09-12 01:52:48 +00:00
jianglingxia 4629c8a54e squash the commits into one 2017-09-04 09:44:53 +08:00
Jan Safranek d9500105d8 Share /var/lib/kubernetes on startup
Kubelet makes sure that /var/lib/kubelet is rshared when it starts.
If not, it bind-mounts it with rshared propagation to containers
that mount volumes to /var/lib/kubelet can benefit from mount propagation.
2017-08-30 16:45:04 +02:00
Serguei Bezverkhi 1be99dd78e Adding fsGroup check before mounting a volume
fsGroup check will be enforcing that if a volume has already been
mounted by one pod and another pod wants to mount it but has a different
fsGroup value, this mount operation will not be allowed.
2017-08-24 17:33:51 -04:00
Kubernetes Submit Queue 198e83588b Merge pull request #46458 from jsafrane/mount-prep
Automatic merge from submit-queue (batch tested with PRs 46458, 50934, 50766, 50970, 47698)

Prepare VolumeHost for running mount tools in containers

This is the first part of implementation of https://github.com/kubernetes/features/issues/278 - running mount utilities in containers.

It updates `VolumeHost` interface:

*  `GetMounter()` now requires volume plugin name, as it is going to return different mounter to different volume plugings, because mount utilities for these plugins can be on different places.
* New `GetExec()` method that should volume plugins use to execute any utilities. This new `Exec` interface will execute them on proper place.
* `SafeFormatAndMount` is updated to the new `Exec` interface.

This is just a preparation, `GetExec` right now leads to simple `os.Exec` and mount utilities are executed on the same place as before. Also, the volume plugins will be updated in subsequent PRs (split into separate PRs, some plugins required lot of changes).

```release-note
NONE
```

@kubernetes/sig-storage-pr-reviews 
@rootfs @gnufied
2017-08-21 18:11:16 -07:00
Kubernetes Submit Queue 990395d5ea Merge pull request #47506 from zhangxiaoyu-zidif/replace-sliceequal-by-deepequal
Automatic merge from submit-queue (batch tested with PRs 50693, 50831, 47506, 49119, 50871)

Use reflect.DeepEqual to replace slicesEqual

**What this PR does / why we need it**:

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes https://github.com/kubernetes/kubernetes/issues/50952

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-08-21 14:30:00 -07:00
Jan Safranek 0e547bae22 SafeFormatAndMount should use volume.Exec provided by VolumeHost
We need to execute mkfs / fsck where the utilities are.
2017-08-14 12:16:27 +02:00
Jan Safranek 282404cbc9 Add Exec interface to VolumeHost
This exec should be used by volume plugins to execute mount utilities.
It will eventually execute things in mount containers.
2017-08-14 12:16:25 +02:00
Jeff Grafton a7f49c906d Use buildozer to delete licenses() rules except under third_party/ 2017-08-11 09:32:39 -07:00