mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Implement CanMount() for gfsMounter for linux
This commit is contained in:
parent
f228edbf8e
commit
b85ac95143
@ -35,6 +35,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/util/strings"
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
volutil "k8s.io/kubernetes/pkg/volume/util"
|
volutil "k8s.io/kubernetes/pkg/volume/util"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is the primary entrypoint for volume plugins.
|
// This is the primary entrypoint for volume plugins.
|
||||||
@ -66,6 +67,7 @@ const (
|
|||||||
annGlusterSecretNamespace = "glusterfs.kubernetes.io/secretnamespace"
|
annGlusterSecretNamespace = "glusterfs.kubernetes.io/secretnamespace"
|
||||||
annGlusterUserKey = "glusterfs.kubernetes.io/userkey"
|
annGlusterUserKey = "glusterfs.kubernetes.io/userkey"
|
||||||
annGlusterUser = "glusterfs.kubernetes.io/userid"
|
annGlusterUser = "glusterfs.kubernetes.io/userid"
|
||||||
|
gciGlusterMountBinariesPath = "/sbin/mount.glusterfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (plugin *glusterfsPlugin) Init(host volume.VolumeHost) error {
|
func (plugin *glusterfsPlugin) Init(host volume.VolumeHost) error {
|
||||||
@ -211,6 +213,13 @@ func (b *glusterfsMounter) GetAttributes() volume.Attributes {
|
|||||||
// to mount the volume are available on the underlying node.
|
// to mount the volume are available on the underlying node.
|
||||||
// If not, it returns an error
|
// If not, it returns an error
|
||||||
func (b *glusterfsMounter) CanMount() error {
|
func (b *glusterfsMounter) CanMount() error {
|
||||||
|
exe := exec.New()
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "linux":
|
||||||
|
if _, err := exe.Command("/bin/ls", gciGlusterMountBinariesPath).CombinedOutput(); err != nil {
|
||||||
|
return fmt.Errorf("Required binary %s is missing", gciGlusterMountBinariesPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user