Don't create mounter when reconstructing block volume

CSI mounter will create a new directory + json for a filesystem volume,
leading to even more orphaned files/directories.
This commit is contained in:
Jan Safranek
2019-07-09 15:34:16 +02:00
committed by Masaki Kimura
parent f1d2d9d670
commit bab81b809b
2 changed files with 36 additions and 24 deletions

View File

@@ -543,10 +543,12 @@ type MountedVolume struct {
// Mounter is the volume mounter used to mount this volume. It is required
// by kubelet to create container.VolumeMap.
// Mounter is only required for file system volumes and not required for block volumes.
Mounter volume.Mounter
// BlockVolumeMapper is the volume mapper used to map this volume. It is required
// by kubelet to create container.VolumeMap.
// BlockVolumeMapper is only required for block volumes and not required for file system volumes.
BlockVolumeMapper volume.BlockVolumeMapper
// VolumeGidValue contains the value of the GID annotation, if present.
@@ -935,6 +937,9 @@ func (oe *operationExecutor) CheckVolumeExistenceOperation(
if attachable != nil {
var isNotMount bool
var mountCheckErr error
if mounter == nil {
return false, fmt.Errorf("mounter was not set for a filesystem volume")
}
if isNotMount, mountCheckErr = mounter.IsLikelyNotMountPoint(mountPath); mountCheckErr != nil {
return false, fmt.Errorf("Could not check whether the volume %q (spec.Name: %q) pod %q (UID: %q) is mounted with: %v",
uniqueVolumeName,