diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 6e214db5d8a..4bcacd1790e 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -749,7 +749,6 @@ function construct-linux-kubelet-flags { flags="$(construct-common-kubelet-flags)" # Keep in sync with CONTAINERIZED_MOUNTER_HOME in configure-helper.sh flags+=" --experimental-mounter-path=/home/kubernetes/containerized_mounter/mounter" - flags+=" --experimental-check-node-capabilities-before-mount=true" # Keep in sync with the mkdir command in configure-helper.sh (until the TODO is resolved) flags+=" --cert-dir=/var/lib/kubelet/pki/" diff --git a/cmd/kubelet/app/options/options.go b/cmd/kubelet/app/options/options.go index 02d7f3f9f74..986c638bce1 100644 --- a/cmd/kubelet/app/options/options.go +++ b/cmd/kubelet/app/options/options.go @@ -102,10 +102,6 @@ type KubeletFlags struct { RemoteImageEndpoint string // experimentalMounterPath is the path of mounter binary. Leave empty to use the default mount path ExperimentalMounterPath string - // This flag, if set, enables a check prior to mount operations to verify that the required components - // (binaries, etc.) to mount the volume are available on the underlying node. If the check is enabled - // and fails the mount operation fails. - ExperimentalCheckNodeCapabilitiesBeforeMount bool // This flag, if set, will avoid including `EvictionHard` limits while computing Node Allocatable. // Refer to [Node Allocatable](https://git.k8s.io/community/contributors/design-proposals/node/node-allocatable.md) doc for more information. ExperimentalNodeAllocatableIgnoreEvictionThreshold bool @@ -328,8 +324,6 @@ func (f *KubeletFlags) AddFlags(mainfs *pflag.FlagSet) { fs.MarkDeprecated("keep-terminated-pod-volumes", "will be removed in a future version") fs.StringVar(&f.ExperimentalMounterPath, "experimental-mounter-path", f.ExperimentalMounterPath, "[Experimental] Path of mounter binary. Leave empty to use the default mount.") fs.MarkDeprecated("experimental-mounter-path", "will be removed in 1.24 or later. in favor of using CSI.") - fs.BoolVar(&f.ExperimentalCheckNodeCapabilitiesBeforeMount, "experimental-check-node-capabilities-before-mount", f.ExperimentalCheckNodeCapabilitiesBeforeMount, "[Experimental] if set true, the kubelet will check the underlying node for required components (binaries, etc.) before performing the mount") - fs.MarkDeprecated("experimental-check-node-capabilities-before-mount", "will be removed in 1.24 or later. in favor of using CSI.") fs.StringVar(&f.CloudProvider, "cloud-provider", f.CloudProvider, "The provider for cloud services. Set to empty string for running with no cloud provider. If set, the cloud provider determines the name of the node (consult cloud provider documentation to determine if and how the hostname is used).") fs.MarkDeprecated("cloud-provider", "will be removed in 1.24 or later, in favor of removing cloud provider code from Kubelet.") fs.StringVar(&f.CloudConfigFile, "cloud-config", f.CloudConfigFile, "The path to the cloud provider configuration file. Empty string for no configuration file.") diff --git a/cmd/kubelet/app/server.go b/cmd/kubelet/app/server.go index 7500510e3b6..7c983f417e6 100644 --- a/cmd/kubelet/app/server.go +++ b/cmd/kubelet/app/server.go @@ -1123,7 +1123,6 @@ func RunKubelet(kubeServer *options.KubeletServer, kubeDeps *kubelet.Dependencie kubeServer.AllowedUnsafeSysctls, kubeServer.ExperimentalMounterPath, kubeServer.KernelMemcgNotification, - kubeServer.ExperimentalCheckNodeCapabilitiesBeforeMount, kubeServer.ExperimentalNodeAllocatableIgnoreEvictionThreshold, kubeServer.MinimumGCAge, kubeServer.MaxPerPodContainerCount, @@ -1197,7 +1196,6 @@ func createAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration, allowedUnsafeSysctls []string, experimentalMounterPath string, kernelMemcgNotification bool, - experimentalCheckNodeCapabilitiesBeforeMount bool, experimentalNodeAllocatableIgnoreEvictionThreshold bool, minimumGCAge metav1.Duration, maxPerPodContainerCount int32, @@ -1230,7 +1228,6 @@ func createAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration, allowedUnsafeSysctls, experimentalMounterPath, kernelMemcgNotification, - experimentalCheckNodeCapabilitiesBeforeMount, experimentalNodeAllocatableIgnoreEvictionThreshold, minimumGCAge, maxPerPodContainerCount, diff --git a/pkg/controller/volume/attachdetach/attach_detach_controller.go b/pkg/controller/volume/attachdetach/attach_detach_controller.go index a7c1d5edc80..f84194934e8 100644 --- a/pkg/controller/volume/attachdetach/attach_detach_controller.go +++ b/pkg/controller/volume/attachdetach/attach_detach_controller.go @@ -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) diff --git a/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go b/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go index 552572ccaa4..413181a49c8 100644 --- a/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go +++ b/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go @@ -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( diff --git a/pkg/controller/volume/expand/expand_controller.go b/pkg/controller/volume/expand/expand_controller.go index 78865c56b9f..93f04d6bac6 100644 --- a/pkg/controller/volume/expand/expand_controller.go +++ b/pkg/controller/volume/expand/expand_controller.go @@ -143,7 +143,6 @@ func NewExpandController( kubeClient, &expc.volumePluginMgr, expc.recorder, - false, blkutil) pvcInformer.Informer().AddEventHandler(kcache.ResourceEventHandlerFuncs{ diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 4d71e685369..2b96020d722 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -324,7 +324,6 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration, allowedUnsafeSysctls []string, experimentalMounterPath string, kernelMemcgNotification bool, - experimentalCheckNodeCapabilitiesBeforeMount bool, experimentalNodeAllocatableIgnoreEvictionThreshold bool, minimumGCAge metav1.Duration, maxPerPodContainerCount int32, @@ -746,7 +745,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) @@ -765,7 +763,6 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration, kubeDeps.HostUtil, klet.getPodsDir(), kubeDeps.Recorder, - experimentalCheckNodeCapabilitiesBeforeMount, keepTerminatedPodVolumes, volumepathhandler.NewBlockVolumePathHandler()) diff --git a/pkg/kubelet/kubelet_test.go b/pkg/kubelet/kubelet_test.go index 68be62d05f4..d7fe88c446d 100644 --- a/pkg/kubelet/kubelet_test.go +++ b/pkg/kubelet/kubelet_test.go @@ -363,7 +363,6 @@ func newTestKubeletWithImageList( kubelet.hostutil, kubelet.getPodsDir(), kubelet.recorder, - false, /* experimentalCheckNodeCapabilitiesBeforeMount*/ false, /* keepTerminatedPodVolumes */ volumetest.NewBlockVolumePathHandler()) diff --git a/pkg/kubelet/kubelet_volumes_test.go b/pkg/kubelet/kubelet_volumes_test.go index 24b3a71ca12..d5a0110b068 100644 --- a/pkg/kubelet/kubelet_volumes_test.go +++ b/pkg/kubelet/kubelet_volumes_test.go @@ -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 } diff --git a/pkg/kubelet/runonce_test.go b/pkg/kubelet/runonce_test.go index 9f402d99418..7a7f5594f24 100644 --- a/pkg/kubelet/runonce_test.go +++ b/pkg/kubelet/runonce_test.go @@ -114,7 +114,6 @@ func TestRunOnce(t *testing.T) { kb.hostutil, kb.getPodsDir(), kb.recorder, - false, /* experimentalCheckNodeCapabilitiesBeforeMount */ false, /* keepTerminatedPodVolumes */ volumetest.NewBlockVolumePathHandler()) diff --git a/pkg/kubelet/volumemanager/reconciler/reconciler_test.go b/pkg/kubelet/volumemanager/reconciler/reconciler_test.go index b0c1c0aaa05..89e0319e992 100644 --- a/pkg/kubelet/volumemanager/reconciler/reconciler_test.go +++ b/pkg/kubelet/volumemanager/reconciler/reconciler_test.go @@ -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, diff --git a/pkg/kubelet/volumemanager/volume_manager.go b/pkg/kubelet/volumemanager/volume_manager.go index 22d89583e54..b1a84807ca4 100644 --- a/pkg/kubelet/volumemanager/volume_manager.go +++ b/pkg/kubelet/volumemanager/volume_manager.go @@ -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)), } diff --git a/pkg/kubelet/volumemanager/volume_manager_test.go b/pkg/kubelet/volumemanager/volume_manager_test.go index 5698c79e2e4..8d23092b535 100644 --- a/pkg/kubelet/volumemanager/volume_manager_test.go +++ b/pkg/kubelet/volumemanager/volume_manager_test.go @@ -315,7 +315,6 @@ func newTestVolumeManager(t *testing.T, tmpDir string, podManager kubepod.Manage hostutil.NewFakeHostUtil(nil), "", fakeRecorder, - false, /* experimentalCheckNodeCapabilitiesBeforeMount */ false, /* keepTerminatedPodVolumes */ fakePathHandler) diff --git a/pkg/volume/awsebs/aws_ebs.go b/pkg/volume/awsebs/aws_ebs.go index b349c8651d5..6d4752d17a7 100644 --- a/pkg/volume/awsebs/aws_ebs.go +++ b/pkg/volume/awsebs/aws_ebs.go @@ -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) diff --git a/pkg/volume/azure_file/azure_file.go b/pkg/volume/azure_file/azure_file.go index a3dc6b6b7de..61953cf3d48 100644 --- a/pkg/volume/azure_file/azure_file.go +++ b/pkg/volume/azure_file/azure_file.go @@ -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) diff --git a/pkg/volume/azuredd/azure_mounter.go b/pkg/volume/azuredd/azure_mounter.go index 8dbdf480228..0fe6eec5237 100644 --- a/pkg/volume/azuredd/azure_mounter.go +++ b/pkg/volume/azuredd/azure_mounter.go @@ -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) } diff --git a/pkg/volume/cephfs/cephfs.go b/pkg/volume/cephfs/cephfs.go index 9f866219f23..6aaec9963f7 100644 --- a/pkg/volume/cephfs/cephfs.go +++ b/pkg/volume/cephfs/cephfs.go @@ -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) diff --git a/pkg/volume/cinder/cinder.go b/pkg/volume/cinder/cinder.go index 92bb9096b8b..88f89489aec 100644 --- a/pkg/volume/cinder/cinder.go +++ b/pkg/volume/cinder/cinder.go @@ -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) } diff --git a/pkg/volume/configmap/configmap.go b/pkg/volume/configmap/configmap.go index da719796fa1..e72f5bccb70 100644 --- a/pkg/volume/configmap/configmap.go +++ b/pkg/volume/configmap/configmap.go @@ -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) } diff --git a/pkg/volume/csi/csi_mounter.go b/pkg/volume/csi/csi_mounter.go index 10e823e6913..4098dc3ae45 100644 --- a/pkg/volume/csi/csi_mounter.go +++ b/pkg/volume/csi/csi_mounter.go @@ -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) } diff --git a/pkg/volume/csi/csi_test.go b/pkg/volume/csi/csi_test.go index 559fae6c1e9..a065efc92e1 100644 --- a/pkg/volume/csi/csi_test.go +++ b/pkg/volume/csi/csi_test.go @@ -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 diff --git a/pkg/volume/downwardapi/downwardapi.go b/pkg/volume/downwardapi/downwardapi.go index 310dd223043..08899bfb359 100644 --- a/pkg/volume/downwardapi/downwardapi.go +++ b/pkg/volume/downwardapi/downwardapi.go @@ -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. diff --git a/pkg/volume/emptydir/empty_dir.go b/pkg/volume/emptydir/empty_dir.go index ab897162e6a..19cd6aea282 100644 --- a/pkg/volume/emptydir/empty_dir.go +++ b/pkg/volume/emptydir/empty_dir.go @@ -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) diff --git a/pkg/volume/fc/fc.go b/pkg/volume/fc/fc.go index b16470d7f5f..622624829ee 100644 --- a/pkg/volume/fc/fc.go +++ b/pkg/volume/fc/fc.go @@ -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) } diff --git a/pkg/volume/flexvolume/mounter-defaults.go b/pkg/volume/flexvolume/mounter-defaults.go index c5d99aba64a..91cde7f7e80 100644 --- a/pkg/volume/flexvolume/mounter-defaults.go +++ b/pkg/volume/flexvolume/mounter-defaults.go @@ -50,7 +50,3 @@ func (f *mounterDefaults) GetAttributes() volume.Attributes { SELinuxRelabel: f.flexVolume.plugin.capabilities.SELinuxRelabel, } } - -func (f *mounterDefaults) CanMount() error { - return nil -} diff --git a/pkg/volume/flexvolume/mounter.go b/pkg/volume/flexvolume/mounter.go index 172e3fdb266..8098cfdb66e 100644 --- a/pkg/volume/flexvolume/mounter.go +++ b/pkg/volume/flexvolume/mounter.go @@ -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 -} diff --git a/pkg/volume/flocker/flocker.go b/pkg/volume/flocker/flocker.go index d39a7ce9d98..85442526fa1 100644 --- a/pkg/volume/flocker/flocker.go +++ b/pkg/volume/flocker/flocker.go @@ -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) } diff --git a/pkg/volume/gcepd/gce_pd.go b/pkg/volume/gcepd/gce_pd.go index 2c048671f67..302d6be9613 100644 --- a/pkg/volume/gcepd/gce_pd.go +++ b/pkg/volume/gcepd/gce_pd.go @@ -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) diff --git a/pkg/volume/git_repo/git_repo.go b/pkg/volume/git_repo/git_repo.go index 048faced98e..5f0e7075eb7 100644 --- a/pkg/volume/git_repo/git_repo.go +++ b/pkg/volume/git_repo/git_repo.go @@ -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) diff --git a/pkg/volume/glusterfs/glusterfs.go b/pkg/volume/glusterfs/glusterfs.go index 62aaf4fde24..e915db930cf 100644 --- a/pkg/volume/glusterfs/glusterfs.go +++ b/pkg/volume/glusterfs/glusterfs.go @@ -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) diff --git a/pkg/volume/hostpath/host_path.go b/pkg/volume/hostpath/host_path.go index 3a124ea6c18..8900023c51f 100644 --- a/pkg/volume/hostpath/host_path.go +++ b/pkg/volume/hostpath/host_path.go @@ -231,13 +231,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()) diff --git a/pkg/volume/iscsi/iscsi.go b/pkg/volume/iscsi/iscsi.go index 9bbb404f883..3d6cb58dbec 100644 --- a/pkg/volume/iscsi/iscsi.go +++ b/pkg/volume/iscsi/iscsi.go @@ -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) } diff --git a/pkg/volume/local/local.go b/pkg/volume/local/local.go index 0343112a2a1..d6a5ec85cb1 100644 --- a/pkg/volume/local/local.go +++ b/pkg/volume/local/local.go @@ -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) diff --git a/pkg/volume/nfs/nfs.go b/pkg/volume/nfs/nfs.go index b945d62ca41..4a557e884bd 100644 --- a/pkg/volume/nfs/nfs.go +++ b/pkg/volume/nfs/nfs.go @@ -19,7 +19,6 @@ package nfs import ( "fmt" "os" - "runtime" "time" netutil "k8s.io/utils/net" @@ -199,28 +198,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 diff --git a/pkg/volume/portworx/portworx.go b/pkg/volume/portworx/portworx.go index 9b1397c2cea..927c2e471c3 100644 --- a/pkg/volume/portworx/portworx.go +++ b/pkg/volume/portworx/portworx.go @@ -294,13 +294,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) diff --git a/pkg/volume/projected/projected.go b/pkg/volume/projected/projected.go index 915c11291cc..e30cb802243 100644 --- a/pkg/volume/projected/projected.go +++ b/pkg/volume/projected/projected.go @@ -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) } diff --git a/pkg/volume/quobyte/quobyte.go b/pkg/volume/quobyte/quobyte.go index f7ceb8a834f..90d4f8cc32d 100644 --- a/pkg/volume/quobyte/quobyte.go +++ b/pkg/volume/quobyte/quobyte.go @@ -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)) diff --git a/pkg/volume/rbd/rbd.go b/pkg/volume/rbd/rbd.go index 9655539159d..18c2bdf0920 100644 --- a/pkg/volume/rbd/rbd.go +++ b/pkg/volume/rbd/rbd.go @@ -837,13 +837,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) } diff --git a/pkg/volume/secret/secret.go b/pkg/volume/secret/secret.go index d154dde4c60..0899f512667 100644 --- a/pkg/volume/secret/secret.go +++ b/pkg/volume/secret/secret.go @@ -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) } diff --git a/pkg/volume/storageos/storageos.go b/pkg/volume/storageos/storageos.go index 79b471e2a54..d3d938d3b29 100644 --- a/pkg/volume/storageos/storageos.go +++ b/pkg/volume/storageos/storageos.go @@ -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. diff --git a/pkg/volume/testing/testing.go b/pkg/volume/testing/testing.go index 9b3bde13aa6..6b7c5a98dbe 100644 --- a/pkg/volume/testing/testing.go +++ b/pkg/volume/testing/testing.go @@ -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() diff --git a/pkg/volume/util/operationexecutor/operation_generator.go b/pkg/volume/util/operationexecutor/operation_generator.go index 3adcc7521aa..e857a67b704 100644 --- a/pkg/volume/util/operationexecutor/operation_generator.go +++ b/pkg/volume/util/operationexecutor/operation_generator.go @@ -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), diff --git a/pkg/volume/util/operationexecutor/operation_generator_test.go b/pkg/volume/util/operationexecutor/operation_generator_test.go index c7888ef0901..c86613d54c5 100644 --- a/pkg/volume/util/operationexecutor/operation_generator_test.go +++ b/pkg/volume/util/operationexecutor/operation_generator_test.go @@ -419,7 +419,6 @@ func getTestOperationGenerator(volumePluginMgr *volume.VolumePluginMgr, objects fakeKubeClient, volumePluginMgr, fakeRecorder, - false, fakeHandler) return operationGenerator } diff --git a/pkg/volume/volume.go b/pkg/volume/volume.go index 742d98671e0..f46f7d4876a 100644 --- a/pkg/volume/volume.go +++ b/pkg/volume/volume.go @@ -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 diff --git a/pkg/volume/volume_linux_test.go b/pkg/volume/volume_linux_test.go index 8c8f4430aa3..38c3b5b3c7c 100644 --- a/pkg/volume/volume_linux_test.go +++ b/pkg/volume/volume_linux_test.go @@ -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 } diff --git a/pkg/volume/vsphere_volume/vsphere_volume.go b/pkg/volume/vsphere_volume/vsphere_volume.go index 1e7a76c8367..0c6c37d6607 100644 --- a/pkg/volume/vsphere_volume/vsphere_volume.go +++ b/pkg/volume/vsphere_volume/vsphere_volume.go @@ -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)