mirror of https://github.com/k3s-io/k3s
nfs: Use VolumeHost.GetExec() to execute stuff in volume plugins
parent
07dea6b447
commit
85495bd102
|
@ -21,7 +21,6 @@ go_library(
|
|||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
"//vendor/k8s.io/utils/exec:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import (
|
|||
"k8s.io/kubernetes/pkg/util/strings"
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
"k8s.io/kubernetes/pkg/volume/util"
|
||||
"k8s.io/utils/exec"
|
||||
)
|
||||
|
||||
// This is the primary entrypoint for volume plugins.
|
||||
|
@ -192,18 +191,18 @@ func (nfsVolume *nfs) GetPath() string {
|
|||
// to mount the volume are available on the underlying node.
|
||||
// If not, it returns an error
|
||||
func (nfsMounter *nfsMounter) CanMount() error {
|
||||
exe := exec.New()
|
||||
exec := nfsMounter.plugin.host.GetExec(nfsMounter.plugin.GetPluginName())
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
if _, err := exe.Command("/bin/ls", "/sbin/mount.nfs").CombinedOutput(); err != nil {
|
||||
if _, err := exec.Run("/bin/ls", "/sbin/mount.nfs"); err != nil {
|
||||
return fmt.Errorf("Required binary /sbin/mount.nfs is missing")
|
||||
}
|
||||
if _, err := exe.Command("/bin/ls", "/sbin/mount.nfs4").CombinedOutput(); err != nil {
|
||||
if _, err := exec.Run("/bin/ls", "/sbin/mount.nfs4"); err != nil {
|
||||
return fmt.Errorf("Required binary /sbin/mount.nfs4 is missing")
|
||||
}
|
||||
return nil
|
||||
case "darwin":
|
||||
if _, err := exe.Command("/bin/ls", "/sbin/mount_nfs").CombinedOutput(); err != nil {
|
||||
if _, err := exec.Run("/bin/ls", "/sbin/mount_nfs"); err != nil {
|
||||
return fmt.Errorf("Required binary /sbin/mount_nfs is missing")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue