refact(deps): bump k8s and client-go deps to version v0.20.2 (#294)

Signed-off-by: prateekpandey14 <prateek.pandey@mayadata.io>
This commit is contained in:
Prateek Pandey 2021-03-31 16:43:42 +05:30 committed by GitHub
parent 533e17a9aa
commit b1aa6ab51a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2196 changed files with 306727 additions and 251810 deletions

View file

@ -25,7 +25,8 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/util/mount"
utilexec "k8s.io/utils/exec"
"k8s.io/utils/mount"
)
// MountInfo contains the volume related info
@ -51,7 +52,7 @@ type MountInfo struct {
// FormatAndMountZvol formats and mounts the created volume to the desired mount path
func FormatAndMountZvol(devicePath string, mountInfo *MountInfo) error {
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: mount.NewOsExec()}
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: utilexec.New()}
err := mounter.FormatAndMount(devicePath, mountInfo.MountPath, mountInfo.FSType, mountInfo.MountOptions)
if err != nil {
@ -68,7 +69,7 @@ func FormatAndMountZvol(devicePath string, mountInfo *MountInfo) error {
// UmountVolume unmounts the volume and the corresponding mount path is removed
func UmountVolume(vol *apis.ZFSVolume, targetPath string,
) error {
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: mount.NewOsExec()}
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: utilexec.New()}
dev, ref, err := mount.GetDeviceNameFromMount(mounter, targetPath)
if err != nil {
@ -274,10 +275,10 @@ func MountBlock(vol *apis.ZFSVolume, mountinfo *MountInfo) error {
devicePath := ZFSDevPath + vol.Spec.PoolName + "/" + vol.Name
mountopt := []string{"bind"}
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: mount.NewOsExec()}
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: utilexec.New()}
// Create the mount point as a file since bind mount device node requires it to be a file
err := mounter.MakeFile(target)
err := makeFile(target)
if err != nil {
return status.Errorf(codes.Internal, "Could not create target file %q: %v", target, err)
}
@ -294,3 +295,14 @@ func MountBlock(vol *apis.ZFSVolume, mountinfo *MountInfo) error {
return nil
}
func makeFile(pathname string) error {
f, err := os.OpenFile(pathname, os.O_CREATE, os.FileMode(0644))
defer f.Close()
if err != nil {
if !os.IsExist(err) {
return err
}
}
return nil
}

View file

@ -21,7 +21,7 @@ import (
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/utils/mount"
)
// ResizeExtn can be used to run a resize command on the ext2/3/4 filesystem