mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
vendor updates
This commit is contained in:
4
vendor/k8s.io/kubernetes/pkg/volume/nfs/BUILD
generated
vendored
4
vendor/k8s.io/kubernetes/pkg/volume/nfs/BUILD
generated
vendored
@ -18,6 +18,7 @@ go_library(
|
||||
"//pkg/util/strings:go_default_library",
|
||||
"//pkg/volume:go_default_library",
|
||||
"//pkg/volume/util:go_default_library",
|
||||
"//pkg/volume/util/recyclerclient:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
@ -28,8 +29,7 @@ go_library(
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["nfs_test.go"],
|
||||
importpath = "k8s.io/kubernetes/pkg/volume/nfs",
|
||||
library = ":go_default_library",
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//pkg/util/mount:go_default_library",
|
||||
"//pkg/volume:go_default_library",
|
||||
|
28
vendor/k8s.io/kubernetes/pkg/volume/nfs/nfs.go
generated
vendored
28
vendor/k8s.io/kubernetes/pkg/volume/nfs/nfs.go
generated
vendored
@ -29,6 +29,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/util/strings"
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
"k8s.io/kubernetes/pkg/volume/util"
|
||||
"k8s.io/kubernetes/pkg/volume/util/recyclerclient"
|
||||
)
|
||||
|
||||
// This is the primary entrypoint for volume plugins.
|
||||
@ -123,7 +124,7 @@ func (plugin *nfsPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, moun
|
||||
server: source.Server,
|
||||
exportPath: source.Path,
|
||||
readOnly: readOnly,
|
||||
mountOptions: volume.MountOptionFromSpec(spec),
|
||||
mountOptions: util.MountOptionFromSpec(spec),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -142,13 +143,13 @@ func (plugin *nfsPlugin) newUnmounterInternal(volName string, podUID types.UID,
|
||||
|
||||
// Recycle recycles/scrubs clean an NFS volume.
|
||||
// Recycle blocks until the pod has completed or any error occurs.
|
||||
func (plugin *nfsPlugin) Recycle(pvName string, spec *volume.Spec, eventRecorder volume.RecycleEventRecorder) error {
|
||||
func (plugin *nfsPlugin) Recycle(pvName string, spec *volume.Spec, eventRecorder recyclerclient.RecycleEventRecorder) error {
|
||||
if spec.PersistentVolume == nil || spec.PersistentVolume.Spec.NFS == nil {
|
||||
return fmt.Errorf("spec.PersistentVolumeSource.NFS is nil")
|
||||
}
|
||||
|
||||
pod := plugin.config.RecyclerPodTemplate
|
||||
timeout := volume.CalculateTimeoutForVolume(plugin.config.RecyclerMinimumTimeout, plugin.config.RecyclerTimeoutIncrement, spec.PersistentVolume)
|
||||
timeout := util.CalculateTimeoutForVolume(plugin.config.RecyclerMinimumTimeout, plugin.config.RecyclerTimeoutIncrement, spec.PersistentVolume)
|
||||
// overrides
|
||||
pod.Spec.ActiveDeadlineSeconds = &timeout
|
||||
pod.GenerateName = "pv-recycler-nfs-"
|
||||
@ -158,7 +159,7 @@ func (plugin *nfsPlugin) Recycle(pvName string, spec *volume.Spec, eventRecorder
|
||||
Path: spec.PersistentVolume.Spec.NFS.Path,
|
||||
},
|
||||
}
|
||||
return volume.RecycleVolumeByWatchingPodUntilCompletion(pvName, pod, plugin.host.GetKubeClient(), eventRecorder)
|
||||
return recyclerclient.RecycleVolumeByWatchingPodUntilCompletion(pvName, pod, plugin.host.GetKubeClient(), eventRecorder)
|
||||
}
|
||||
|
||||
func (plugin *nfsPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
|
||||
@ -194,15 +195,15 @@ func (nfsMounter *nfsMounter) CanMount() error {
|
||||
exec := nfsMounter.plugin.host.GetExec(nfsMounter.plugin.GetPluginName())
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
if _, err := exec.Run("/bin/ls", "/sbin/mount.nfs"); err != nil {
|
||||
if _, err := exec.Run("test", "-x", "/sbin/mount.nfs"); err != nil {
|
||||
return fmt.Errorf("Required binary /sbin/mount.nfs is missing")
|
||||
}
|
||||
if _, err := exec.Run("/bin/ls", "/sbin/mount.nfs4"); err != nil {
|
||||
if _, err := exec.Run("test", "-x", "/sbin/mount.nfs4"); err != nil {
|
||||
return fmt.Errorf("Required binary /sbin/mount.nfs4 is missing")
|
||||
}
|
||||
return nil
|
||||
case "darwin":
|
||||
if _, err := exec.Run("/bin/ls", "/sbin/mount_nfs"); err != nil {
|
||||
if _, err := exec.Run("test", "-x", "/sbin/mount_nfs"); err != nil {
|
||||
return fmt.Errorf("Required binary /sbin/mount_nfs is missing")
|
||||
}
|
||||
}
|
||||
@ -233,7 +234,7 @@ func (b *nfsMounter) SetUp(fsGroup *int64) error {
|
||||
}
|
||||
|
||||
func (b *nfsMounter) SetUpAt(dir string, fsGroup *int64) error {
|
||||
notMnt, err := b.mounter.IsLikelyNotMountPoint(dir)
|
||||
notMnt, err := b.mounter.IsNotMountPoint(dir)
|
||||
glog.V(4).Infof("NFS mount set up: %s %v %v", dir, !notMnt, err)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
@ -249,10 +250,10 @@ func (b *nfsMounter) SetUpAt(dir string, fsGroup *int64) error {
|
||||
if b.readOnly {
|
||||
options = append(options, "ro")
|
||||
}
|
||||
mountOptions := volume.JoinMountOptions(b.mountOptions, options)
|
||||
mountOptions := util.JoinMountOptions(b.mountOptions, options)
|
||||
err = b.mounter.Mount(source, dir, "nfs", mountOptions)
|
||||
if err != nil {
|
||||
notMnt, mntErr := b.mounter.IsLikelyNotMountPoint(dir)
|
||||
notMnt, mntErr := b.mounter.IsNotMountPoint(dir)
|
||||
if mntErr != nil {
|
||||
glog.Errorf("IsLikelyNotMountPoint check failed: %v", mntErr)
|
||||
return err
|
||||
@ -262,7 +263,7 @@ func (b *nfsMounter) SetUpAt(dir string, fsGroup *int64) error {
|
||||
glog.Errorf("Failed to unmount: %v", mntErr)
|
||||
return err
|
||||
}
|
||||
notMnt, mntErr := b.mounter.IsLikelyNotMountPoint(dir)
|
||||
notMnt, mntErr := b.mounter.IsNotMountPoint(dir)
|
||||
if mntErr != nil {
|
||||
glog.Errorf("IsLikelyNotMountPoint check failed: %v", mntErr)
|
||||
return err
|
||||
@ -290,7 +291,10 @@ func (c *nfsUnmounter) TearDown() error {
|
||||
}
|
||||
|
||||
func (c *nfsUnmounter) TearDownAt(dir string) error {
|
||||
return util.UnmountPath(dir, c.mounter)
|
||||
// Use extensiveMountPointCheck to consult /proc/mounts. We can't use faster
|
||||
// IsLikelyNotMountPoint (lstat()), since there may be root_squash on the
|
||||
// NFS server and kubelet may not be able to do lstat/stat() there.
|
||||
return util.UnmountMountPoint(dir, c.mounter, true /* extensiveMountPointCheck */)
|
||||
}
|
||||
|
||||
func getVolumeSource(spec *volume.Spec) (*v1.NFSVolumeSource, bool, error) {
|
||||
|
Reference in New Issue
Block a user