Commit 1feb0fa6 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #49118 from adelton/flex-bind-mount

Automatic merge from submit-queue (batch tested with PRs 49444, 47864, 48584, 49395, 49118) Allow unmounting bind-mounted directories. **What this PR does / why we need it**: For files, we cannot use `path/..`; we could use `filepath.Dir` but for bind-mounted, `isNotMounted` which calls `IsLikelyNotMountPoint` would not work anyway. Let's just have the driver do the work. Addressing ``` Error: UnmountVolume.TearDown failed for volume "..." (volume.spec.Name: "...") pod "..." (UID: "...") with: lstat /path/.../test-flex/..: not a directory ``` **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # N/A **Special notes for your reviewer**: N/A **Release note**: ```release-note It is now posible to use flexVolumes to bind mount directories and files. ```
parents d95665dc 6b7d4b79
......@@ -51,23 +51,15 @@ func (f *flexVolumeUnmounter) TearDownAt(dir string) error {
return nil
}
notmnt, err := isNotMounted(f.mounter, dir)
call := f.plugin.NewDriverCall(unmountCmd)
call.Append(dir)
_, err := call.Run()
if isCmdNotSupportedErr(err) {
err = (*unmounterDefaults)(f).TearDownAt(dir)
}
if err != nil {
return err
}
if notmnt {
glog.Warningf("Warning: Path: %v already unmounted", dir)
} else {
call := f.plugin.NewDriverCall(unmountCmd)
call.Append(dir)
_, err := call.Run()
if isCmdNotSupportedErr(err) {
err = (*unmounterDefaults)(f).TearDownAt(dir)
}
if err != nil {
return err
}
}
// Flexvolume driver may remove the directory. Ignore if it does.
if pathExists, pathErr := util.PathExists(dir); pathErr != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment