kubelet: Remove the deprecated flag --experimental-check-node-capabilities-before-mount

This commit is contained in:
Mengjiao Liu
2021-09-02 18:49:42 +08:00
parent 2b0ddeb23b
commit beda4cafb6
46 changed files with 15 additions and 310 deletions

View File

@@ -166,7 +166,6 @@ func NewAttachDetachController(
kubeClient,
&adc.volumePluginMgr,
recorder,
false, // flag for experimental binary check for volume mount
blkutil))
adc.nodeStatusUpdater = statusupdater.NewNodeStatusUpdater(
kubeClient, nodeInformer.Lister(), adc.actualStateOfWorld)

View File

@@ -55,7 +55,6 @@ func Test_Run_Positive_DoNothing(t *testing.T) {
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
informerFactory := informers.NewSharedInformerFactory(fakeKubeClient, controller.NoResyncPeriodFunc())
nsu := statusupdater.NewNodeStatusUpdater(
@@ -91,7 +90,6 @@ func Test_Run_Positive_OneDesiredVolumeAttach(t *testing.T) {
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
nsu := statusupdater.NewFakeNodeStatusUpdater(false /* returnError */)
reconciler := NewReconciler(
@@ -143,7 +141,6 @@ func Test_Run_Positive_OneDesiredVolumeAttachThenDetachWithUnmountedVolume(t *te
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
nsu := statusupdater.NewFakeNodeStatusUpdater(false /* returnError */)
reconciler := NewReconciler(
@@ -216,7 +213,6 @@ func Test_Run_Positive_OneDesiredVolumeAttachThenDetachWithMountedVolume(t *test
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
nsu := statusupdater.NewFakeNodeStatusUpdater(false /* returnError */)
reconciler := NewReconciler(
@@ -289,7 +285,6 @@ func Test_Run_Negative_OneDesiredVolumeAttachThenDetachWithUnmountedVolumeUpdate
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
nsu := statusupdater.NewFakeNodeStatusUpdater(true /* returnError */)
reconciler := NewReconciler(
@@ -365,7 +360,6 @@ func Test_Run_OneVolumeAttachAndDetachMultipleNodesWithReadWriteMany(t *testing.
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
nsu := statusupdater.NewFakeNodeStatusUpdater(false /* returnError */)
reconciler := NewReconciler(
@@ -458,7 +452,6 @@ func Test_Run_OneVolumeAttachAndDetachMultipleNodesWithReadWriteOnce(t *testing.
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
nsu := statusupdater.NewFakeNodeStatusUpdater(false /* returnError */)
reconciler := NewReconciler(
@@ -549,7 +542,6 @@ func Test_Run_OneVolumeAttachAndDetachUncertainNodesWithReadWriteOnce(t *testing
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
nsu := statusupdater.NewFakeNodeStatusUpdater(false /* returnError */)
reconciler := NewReconciler(
@@ -611,7 +603,6 @@ func Test_Run_OneVolumeDetachFailNodeWithReadWriteOnce(t *testing.T) {
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
nsu := statusupdater.NewFakeNodeStatusUpdater(false /* returnError */)
reconciler := NewReconciler(
@@ -713,7 +704,6 @@ func Test_Run_OneVolumeAttachAndDetachTimeoutNodesWithReadWriteOnce(t *testing.T
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
nsu := statusupdater.NewFakeNodeStatusUpdater(false /* returnError */)
reconciler := NewReconciler(
@@ -819,7 +809,6 @@ func Test_ReportMultiAttachError(t *testing.T) {
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
nsu := statusupdater.NewFakeNodeStatusUpdater(false /* returnError */)
rc := NewReconciler(

View File

@@ -143,7 +143,6 @@ func NewExpandController(
kubeClient,
&expc.volumePluginMgr,
expc.recorder,
false,
blkutil)
pvcInformer.Informer().AddEventHandler(kcache.ResourceEventHandlerFuncs{

View File

@@ -349,7 +349,6 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
allowedUnsafeSysctls []string,
experimentalMounterPath string,
kernelMemcgNotification bool,
experimentalCheckNodeCapabilitiesBeforeMount bool,
experimentalNodeAllocatableIgnoreEvictionThreshold bool,
minimumGCAge metav1.Duration,
maxPerPodContainerCount int32,
@@ -772,7 +771,6 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
// If the experimentalMounterPathFlag is set, we do not want to
// check node capabilities since the mount path is not the default
if len(experimentalMounterPath) != 0 {
experimentalCheckNodeCapabilitiesBeforeMount = false
// Replace the nameserver in containerized-mounter's rootfs/etc/resolv.conf with kubelet.ClusterDNS
// so that service name could be resolved
klet.dnsConfigurer.SetupDNSinContainerizedMounter(experimentalMounterPath)
@@ -791,7 +789,6 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
kubeDeps.HostUtil,
klet.getPodsDir(),
kubeDeps.Recorder,
experimentalCheckNodeCapabilitiesBeforeMount,
keepTerminatedPodVolumes,
volumepathhandler.NewBlockVolumePathHandler())

View File

@@ -363,7 +363,6 @@ func newTestKubeletWithImageList(
kubelet.hostutil,
kubelet.getPodsDir(),
kubelet.recorder,
false, /* experimentalCheckNodeCapabilitiesBeforeMount*/
false, /* keepTerminatedPodVolumes */
volumetest.NewBlockVolumePathHandler())

View File

@@ -554,10 +554,6 @@ func (f *stubVolume) GetAttributes() volume.Attributes {
return volume.Attributes{}
}
func (f *stubVolume) CanMount() error {
return nil
}
func (f *stubVolume) SetUp(mounterArgs volume.MounterArgs) error {
return nil
}

View File

@@ -114,7 +114,6 @@ func TestRunOnce(t *testing.T) {
kb.hostutil,
kb.getPodsDir(),
kb.recorder,
false, /* experimentalCheckNodeCapabilitiesBeforeMount */
false, /* keepTerminatedPodVolumes */
volumetest.NewBlockVolumePathHandler())

View File

@@ -76,7 +76,6 @@ func Test_Run_Positive_DoNothing(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler,
))
reconciler := NewReconciler(
@@ -121,7 +120,6 @@ func Test_Run_Positive_VolumeAttachAndMount(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
kubeClient,
@@ -212,7 +210,6 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabled(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
kubeClient,
@@ -292,7 +289,6 @@ func Test_Run_Negative_VolumeMountControllerAttachEnabled(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
kubeClient,
@@ -371,7 +367,6 @@ func Test_Run_Positive_VolumeAttachMountUnmountDetach(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
kubeClient,
@@ -474,7 +469,6 @@ func Test_Run_Positive_VolumeUnmountControllerAttachEnabled(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
kubeClient,
@@ -598,7 +592,6 @@ func Test_Run_Positive_VolumeAttachAndMap(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
kubeClient,
@@ -714,7 +707,6 @@ func Test_Run_Positive_BlockVolumeMapControllerAttachEnabled(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
kubeClient,
@@ -812,7 +804,6 @@ func Test_Run_Positive_BlockVolumeAttachMapUnmapDetach(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
kubeClient,
@@ -937,7 +928,6 @@ func Test_Run_Positive_VolumeUnmapControllerAttachEnabled(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
kubeClient,
@@ -1014,8 +1004,7 @@ func Test_GenerateMapVolumeFunc_Plugin_Not_Found(t *testing.T) {
oex := operationexecutor.NewOperationExecutor(operationexecutor.NewOperationGenerator(
nil, /* kubeClient */
volumePluginMgr,
nil, /* fakeRecorder */
false, /* checkNodeCapabilitiesBeforeMount */
nil, /* fakeRecorder */
nil))
pod := &v1.Pod{
@@ -1065,8 +1054,7 @@ func Test_GenerateUnmapVolumeFunc_Plugin_Not_Found(t *testing.T) {
oex := operationexecutor.NewOperationExecutor(operationexecutor.NewOperationGenerator(
nil, /* kubeClient */
volumePluginMgr,
nil, /* fakeRecorder */
false, /* checkNodeCapabilitiesBeforeMount */
nil, /* fakeRecorder */
nil))
volumeMode := v1.PersistentVolumeBlock
tmpSpec := &volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{VolumeMode: &volumeMode}}}
@@ -1108,8 +1096,7 @@ func Test_GenerateUnmapDeviceFunc_Plugin_Not_Found(t *testing.T) {
oex := operationexecutor.NewOperationExecutor(operationexecutor.NewOperationGenerator(
nil, /* kubeClient */
volumePluginMgr,
nil, /* fakeRecorder */
false, /* checkNodeCapabilitiesBeforeMount */
nil, /* fakeRecorder */
nil))
var hostutil hostutil.HostUtils
volumeMode := v1.PersistentVolumeBlock
@@ -1259,7 +1246,6 @@ func Test_Run_Positive_VolumeFSResizeControllerAttachEnabled(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
@@ -1450,7 +1436,6 @@ func Test_UncertainDeviceGlobalMounts(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
@@ -1673,7 +1658,6 @@ func Test_UncertainVolumeMountState(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
@@ -1985,7 +1969,6 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) {
kubeClient,
volumePluginMgr,
fakeRecorder,
false, /* checkNodeCapabilitiesBeforeMount */
fakeHandler))
reconciler := NewReconciler(
kubeClient,

View File

@@ -180,7 +180,6 @@ func NewVolumeManager(
hostutil hostutil.HostUtils,
kubeletPodsDir string,
recorder record.EventRecorder,
checkNodeCapabilitiesBeforeMount bool,
keepTerminatedPodVolumes bool,
blockVolumePathHandler volumepathhandler.BlockVolumePathHandler) VolumeManager {
@@ -193,7 +192,6 @@ func NewVolumeManager(
kubeClient,
volumePluginMgr,
recorder,
checkNodeCapabilitiesBeforeMount,
blockVolumePathHandler)),
}

View File

@@ -315,7 +315,6 @@ func newTestVolumeManager(t *testing.T, tmpDir string, podManager kubepod.Manage
hostutil.NewFakeHostUtil(nil),
"",
fakeRecorder,
false, /* experimentalCheckNodeCapabilitiesBeforeMount */
false, /* keepTerminatedPodVolumes */
fakePathHandler)

View File

@@ -356,13 +356,6 @@ func (b *awsElasticBlockStoreMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *awsElasticBlockStoreMounter) CanMount() error {
return nil
}
// SetUp attaches the disk and bind mounts to the volume path.
func (b *awsElasticBlockStoreMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)

View File

@@ -245,13 +245,6 @@ func (b *azureFileMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *azureFileMounter) CanMount() error {
return nil
}
// SetUp attaches the disk and bind mounts to the volume path.
func (b *azureFileMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)

View File

@@ -62,10 +62,6 @@ func (m *azureDiskMounter) GetAttributes() volume.Attributes {
}
}
func (m *azureDiskMounter) CanMount() error {
return nil
}
func (m *azureDiskMounter) SetUp(mounterArgs volume.MounterArgs) error {
return m.SetUpAt(m.GetPath(), mounterArgs)
}

View File

@@ -212,13 +212,6 @@ func (cephfsVolume *cephfsMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (cephfsVolume *cephfsMounter) CanMount() error {
return nil
}
// SetUp attaches the disk and bind mounts to the volume path.
func (cephfsVolume *cephfsMounter) SetUp(mounterArgs volume.MounterArgs) error {
return cephfsVolume.SetUpAt(cephfsVolume.GetPath(), mounterArgs)

View File

@@ -377,13 +377,6 @@ func (b *cinderVolumeMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *cinderVolumeMounter) CanMount() error {
return nil
}
func (b *cinderVolumeMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)
}

View File

@@ -173,13 +173,6 @@ func wrappedVolumeSpec() volume.Spec {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *configMapVolumeMounter) CanMount() error {
return nil
}
func (b *configMapVolumeMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)
}

View File

@@ -96,10 +96,6 @@ func getTargetPath(uid types.UID, specVolumeID string, host volume.VolumeHost) s
// volume.Mounter methods
var _ volume.Mounter = &csiMountMgr{}
func (c *csiMountMgr) CanMount() error {
return nil
}
func (c *csiMountMgr) SetUp(mounterArgs volume.MounterArgs) error {
return c.SetUpAt(c.GetPath(), mounterArgs)
}

View File

@@ -444,10 +444,6 @@ func TestCSI_VolumeAll(t *testing.T) {
t.Fatalf("csiTest.VolumeAll volPlugin.NewMounter is nil or error: %s", err)
}
if err := mounter.CanMount(); err != nil {
t.Fatal("csiTest.VolumeAll mounter.CanMount failed, skipping mount")
}
var fsGroup *int64
if pod.Spec.SecurityContext != nil && pod.Spec.SecurityContext.FSGroup != nil {
fsGroup = pod.Spec.SecurityContext.FSGroup

View File

@@ -159,13 +159,6 @@ func (d *downwardAPIVolume) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *downwardAPIVolumeMounter) CanMount() error {
return nil
}
// SetUp puts in place the volume plugin.
// This function is not idempotent by design. We want the data to be refreshed periodically.
// The internal sync interval of kubelet will drive the refresh of data.

View File

@@ -225,13 +225,6 @@ func (ed *emptyDir) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (ed *emptyDir) CanMount() error {
return nil
}
// SetUp creates new directory.
func (ed *emptyDir) SetUp(mounterArgs volume.MounterArgs) error {
return ed.SetUpAt(ed.GetPath(), mounterArgs)

View File

@@ -370,13 +370,6 @@ func (b *fcDiskMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *fcDiskMounter) CanMount() error {
return nil
}
func (b *fcDiskMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)
}

View File

@@ -50,7 +50,3 @@ func (f *mounterDefaults) GetAttributes() volume.Attributes {
SupportsSELinux: f.flexVolume.plugin.capabilities.SELinuxRelabel,
}
}
func (f *mounterDefaults) CanMount() error {
return nil
}

View File

@@ -107,7 +107,3 @@ func (f *flexVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs)
func (f *flexVolumeMounter) GetAttributes() volume.Attributes {
return (*mounterDefaults)(f).GetAttributes()
}
func (f *flexVolumeMounter) CanMount() error {
return nil
}

View File

@@ -220,13 +220,6 @@ func (b *flockerVolumeMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *flockerVolumeMounter) CanMount() error {
return nil
}
func (b *flockerVolumeMounter) GetPath() string {
return getPath(b.podUID, b.volName, b.plugin.host)
}

View File

@@ -360,13 +360,6 @@ func (b *gcePersistentDiskMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *gcePersistentDiskMounter) CanMount() error {
return nil
}
// SetUp bind mounts the disk global mount to the volume path.
func (b *gcePersistentDiskMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)

View File

@@ -167,13 +167,6 @@ func (b *gitRepoVolumeMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *gitRepoVolumeMounter) CanMount() error {
return nil
}
// SetUp creates new directory and clones a git repo.
func (b *gitRepoVolumeMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)

View File

@@ -25,7 +25,6 @@ import (
"net/http"
"os"
"path/filepath"
"runtime"
"strconv"
dstrings "strings"
"sync"
@@ -73,14 +72,13 @@ var _ volume.Provisioner = &glusterfsVolumeProvisioner{}
var _ volume.Deleter = &glusterfsVolumeDeleter{}
const (
glusterfsPluginName = "kubernetes.io/glusterfs"
volPrefix = "vol_"
dynamicEpSvcPrefix = "glusterfs-dynamic"
replicaCount = 3
secretKeyName = "key" // key name used in secret
gciLinuxGlusterMountBinaryPath = "/sbin/mount.glusterfs"
defaultGidMin = 2000
defaultGidMax = math.MaxInt32
glusterfsPluginName = "kubernetes.io/glusterfs"
volPrefix = "vol_"
dynamicEpSvcPrefix = "glusterfs-dynamic"
replicaCount = 3
secretKeyName = "key" // key name used in secret
defaultGidMin = 2000
defaultGidMax = math.MaxInt32
// maxCustomEpNamePrefix is the maximum number of chars.
// which can be used as ep/svc name prefix. This number is carved
@@ -257,20 +255,6 @@ func (b *glusterfsMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *glusterfsMounter) CanMount() error {
exe := b.plugin.host.GetExec(b.plugin.GetPluginName())
switch runtime.GOOS {
case "linux":
if _, err := exe.Command("test", "-x", gciLinuxGlusterMountBinaryPath).CombinedOutput(); err != nil {
return fmt.Errorf("required binary %s is missing", gciLinuxGlusterMountBinaryPath)
}
}
return nil
}
// SetUp attaches the disk and bind mounts to the volume path.
func (b *glusterfsMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)

View File

@@ -218,13 +218,6 @@ func (b *hostPathMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *hostPathMounter) CanMount() error {
return nil
}
// SetUp does nothing.
func (b *hostPathMounter) SetUp(mounterArgs volume.MounterArgs) error {
err := validation.ValidatePathNoBacksteps(b.GetPath())

View File

@@ -352,13 +352,6 @@ func (b *iscsiDiskMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *iscsiDiskMounter) CanMount() error {
return nil
}
func (b *iscsiDiskMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)
}

View File

@@ -510,13 +510,6 @@ func (m *localVolumeMounter) GetAttributes() volume.Attributes {
}
}
// CanMount checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (m *localVolumeMounter) CanMount() error {
return nil
}
// SetUp bind mounts the directory to the volume path
func (m *localVolumeMounter) SetUp(mounterArgs volume.MounterArgs) error {
return m.SetUpAt(m.GetPath(), mounterArgs)

View File

@@ -20,7 +20,6 @@ import (
"fmt"
netutil "k8s.io/utils/net"
"os"
"runtime"
"time"
"k8s.io/klog/v2"
@@ -198,28 +197,6 @@ func (nfsVolume *nfs) GetPath() string {
return nfsVolume.plugin.host.GetPodVolumeDir(nfsVolume.pod.UID, utilstrings.EscapeQualifiedName(name), nfsVolume.volName)
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (nfsMounter *nfsMounter) CanMount() error {
exec := nfsMounter.plugin.host.GetExec(nfsMounter.plugin.GetPluginName())
switch runtime.GOOS {
case "linux":
if _, err := exec.Command("test", "-x", "/sbin/mount.nfs").CombinedOutput(); err != nil {
return fmt.Errorf("required binary /sbin/mount.nfs is missing")
}
if _, err := exec.Command("test", "-x", "/sbin/mount.nfs4").CombinedOutput(); err != nil {
return fmt.Errorf("required binary /sbin/mount.nfs4 is missing")
}
return nil
case "darwin":
if _, err := exec.Command("test", "-x", "/sbin/mount_nfs").CombinedOutput(); err != nil {
return fmt.Errorf("required binary /sbin/mount_nfs is missing")
}
}
return nil
}
type nfsMounter struct {
*nfs
server string

View File

@@ -293,13 +293,6 @@ func (b *portworxVolumeMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *portworxVolumeMounter) CanMount() error {
return nil
}
// SetUp attaches the disk and bind mounts to the volume path.
func (b *portworxVolumeMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)

View File

@@ -175,13 +175,6 @@ func (sv *projectedVolume) GetAttributes() volume.Attributes {
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (s *projectedVolumeMounter) CanMount() error {
return nil
}
func (s *projectedVolumeMounter) SetUp(mounterArgs volume.MounterArgs) error {
return s.SetUpAt(s.GetPath(), mounterArgs)
}

View File

@@ -231,13 +231,6 @@ func (mounter *quobyteMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (mounter *quobyteMounter) CanMount() error {
return nil
}
// SetUp attaches the disk and bind mounts to the volume path.
func (mounter *quobyteMounter) SetUp(mounterArgs volume.MounterArgs) error {
pluginDir := mounter.plugin.host.GetPluginDir(utilstrings.EscapeQualifiedName(quobytePluginName))

View File

@@ -838,13 +838,6 @@ func (rbd *rbd) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *rbdMounter) CanMount() error {
return nil
}
func (b *rbdMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)
}

View File

@@ -168,13 +168,6 @@ func (sv *secretVolume) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *secretVolumeMounter) CanMount() error {
return nil
}
func (b *secretVolumeMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)
}

View File

@@ -334,13 +334,6 @@ func (b *storageosMounter) GetAttributes() volume.Attributes {
}
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *storageosMounter) CanMount() error {
return nil
}
// SetUp attaches the disk and bind mounts to the volume path.
func (b *storageosMounter) SetUp(mounterArgs volume.MounterArgs) error {
// Need a namespace to find the volume, try pod's namespace if not set.

View File

@@ -692,10 +692,6 @@ func (_ *FakeVolume) GetAttributes() Attributes {
}
}
func (fv *FakeVolume) CanMount() error {
return nil
}
func (fv *FakeVolume) SetUp(mounterArgs MounterArgs) error {
fv.Lock()
defer fv.Unlock()

View File

@@ -80,11 +80,6 @@ type operationGenerator struct {
// recorder is used to record events in the API server
recorder record.EventRecorder
// checkNodeCapabilitiesBeforeMount, if set, enables the CanMount check,
// which verifies that the components (binaries, etc.) required to mount
// the volume are available on the underlying node before attempting mount.
checkNodeCapabilitiesBeforeMount bool
// blkUtil provides volume path related operations for block volume
blkUtil volumepathhandler.BlockVolumePathHandler
@@ -95,16 +90,14 @@ type operationGenerator struct {
func NewOperationGenerator(kubeClient clientset.Interface,
volumePluginMgr *volume.VolumePluginMgr,
recorder record.EventRecorder,
checkNodeCapabilitiesBeforeMount bool,
blkUtil volumepathhandler.BlockVolumePathHandler) OperationGenerator {
return &operationGenerator{
kubeClient: kubeClient,
volumePluginMgr: volumePluginMgr,
recorder: recorder,
checkNodeCapabilitiesBeforeMount: checkNodeCapabilitiesBeforeMount,
blkUtil: blkUtil,
translator: csitrans.New(),
kubeClient: kubeClient,
volumePluginMgr: volumePluginMgr,
recorder: recorder,
blkUtil: blkUtil,
translator: csitrans.New(),
}
}
@@ -712,16 +705,6 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
}
}
if og.checkNodeCapabilitiesBeforeMount {
if canMountErr := volumeMounter.CanMount(); canMountErr != nil {
err = fmt.Errorf(
"verify that your node machine has the required components before attempting to mount this volume type. %s",
canMountErr)
eventErr, detailedErr := volumeToMount.GenerateError("MountVolume.CanMount failed", err)
return volumetypes.NewOperationContext(eventErr, detailedErr, migrated)
}
}
// Execute mount
mountErr := volumeMounter.SetUp(volume.MounterArgs{
FsUser: util.FsUserFrom(volumeToMount.Pod),

View File

@@ -419,7 +419,6 @@ func getTestOperationGenerator(volumePluginMgr *volume.VolumePluginMgr, objects
fakeKubeClient,
volumePluginMgr,
fakeRecorder,
false,
fakeHandler)
return operationGenerator
}

View File

@@ -136,17 +136,6 @@ type Mounter interface {
// Uses Interface to provide the path for Docker binds.
Volume
// CanMount is called immediately prior to Setup to check if
// the required components (binaries, etc.) are available on
// the underlying node to complete the subsequent SetUp (mount)
// operation. If CanMount returns error, the mount operation is
// aborted and an event is generated indicating that the node
// does not have the required binaries to complete the mount.
// If CanMount succeeds, the mount operation continues
// normally. The CanMount check can be enabled or disabled
// using the experimental-check-mount-binaries binary flag
CanMount() error
// SetUp prepares and mounts/unpacks the volume to a
// self-determined directory path. The mount point and its
// content should be owned by `fsUser` or 'fsGroup' so that it can be

View File

@@ -43,10 +43,6 @@ func (l *localFakeMounter) GetAttributes() Attributes {
return l.attributes
}
func (l *localFakeMounter) CanMount() error {
return nil
}
func (l *localFakeMounter) SetUp(mounterArgs MounterArgs) error {
return nil
}

View File

@@ -218,13 +218,6 @@ func (b *vsphereVolumeMounter) SetUp(mounterArgs volume.MounterArgs) error {
return b.SetUpAt(b.GetPath(), mounterArgs)
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (b *vsphereVolumeMounter) CanMount() error {
return nil
}
// SetUp attaches the disk and bind mounts to the volume path.
func (b *vsphereVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs) error {
klog.V(5).Infof("vSphere volume setup %s to %s", b.volPath, dir)