Skip to content

Commit 7a478a4

Browse files
authored
Merge pull request kubernetes#75844 from vladimirvivien/volume-skip-device-mount
Volume DeviceMountablePlugin.CanDeviceMount check when retrieving plugins
2 parents 30165e4 + 3777514 commit 7a478a4

File tree

15 files changed

+68
-1
lines changed

15 files changed

+68
-1
lines changed

pkg/controller/volume/attachdetach/testing/testvolumespec.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,10 @@ func (plugin *TestPlugin) CanAttach(spec *volume.Spec) bool {
312312
return true
313313
}
314314

315+
func (plugin *TestPlugin) CanDeviceMount(spec *volume.Spec) (bool, error) {
316+
return true, nil
317+
}
318+
315319
func (plugin *TestPlugin) NewDeviceUnmounter() (volume.DeviceUnmounter, error) {
316320
return plugin.NewDetacher()
317321
}

pkg/volume/awsebs/attacher.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ func (plugin *awsElasticBlockStorePlugin) CanAttach(spec *volume.Spec) bool {
281281
return true
282282
}
283283

284+
func (plugin *awsElasticBlockStorePlugin) CanDeviceMount(spec *volume.Spec) (bool, error) {
285+
return true, nil
286+
}
287+
284288
func setNodeDisk(
285289
nodeDiskMap map[types.NodeName]map[*volume.Spec]bool,
286290
volumeSpec *volume.Spec,

pkg/volume/azure_dd/azure_dd.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ func (plugin *azureDataDiskPlugin) CanAttach(spec *volume.Spec) bool {
242242
return true
243243
}
244244

245+
func (plugin *azureDataDiskPlugin) CanDeviceMount(spec *volume.Spec) (bool, error) {
246+
return true, nil
247+
}
248+
245249
func (plugin *azureDataDiskPlugin) NewDeleter(spec *volume.Spec) (volume.Deleter, error) {
246250
volumeSource, _, err := getVolumeSource(spec)
247251
if err != nil {

pkg/volume/cinder/attacher.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,10 @@ func (plugin *cinderPlugin) CanAttach(spec *volume.Spec) bool {
410410
return true
411411
}
412412

413+
func (plugin *cinderPlugin) CanDeviceMount(spec *volume.Spec) (bool, error) {
414+
return true, nil
415+
}
416+
413417
func (attacher *cinderDiskAttacher) nodeInstanceID(nodeName types.NodeName) (string, error) {
414418
instances, res := attacher.cinderProvider.Instances()
415419
if !res {

pkg/volume/csi/csi_plugin.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,11 @@ func (p *csiPlugin) CanAttach(spec *volume.Spec) bool {
604604
return !skipAttach
605605
}
606606

607+
// TODO (#75352) add proper logic to determine device moutability by inspecting the spec.
608+
func (p *csiPlugin) CanDeviceMount(spec *volume.Spec) (bool, error) {
609+
return true, nil
610+
}
611+
607612
func (p *csiPlugin) NewDeviceUnmounter() (volume.DeviceUnmounter, error) {
608613
return p.NewDetacher()
609614
}

pkg/volume/fc/attacher.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ func (plugin *fcPlugin) CanAttach(spec *volume.Spec) bool {
179179
return true
180180
}
181181

182+
func (plugin *fcPlugin) CanDeviceMount(spec *volume.Spec) (bool, error) {
183+
return true, nil
184+
}
185+
182186
func volumeSpecToMounter(spec *volume.Spec, host volume.VolumeHost) (*fcDiskMounter, error) {
183187
fc, readOnly, err := getVolumeSource(spec)
184188
if err != nil {

pkg/volume/flexvolume/plugin.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ func (plugin *flexVolumeAttachablePlugin) CanAttach(spec *volume.Spec) bool {
260260
return true
261261
}
262262

263+
func (plugin *flexVolumeAttachablePlugin) CanDeviceMount(spec *volume.Spec) (bool, error) {
264+
return true, nil
265+
}
266+
263267
// ConstructVolumeSpec is part of the volume.AttachableVolumePlugin interface.
264268
func (plugin *flexVolumePlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
265269
flexVolume := &api.Volume{

pkg/volume/gcepd/attacher.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,7 @@ func (detacher *gcePersistentDiskDetacher) UnmountDevice(deviceMountPath string)
353353
func (plugin *gcePersistentDiskPlugin) CanAttach(spec *volume.Spec) bool {
354354
return true
355355
}
356+
357+
func (plugin *gcePersistentDiskPlugin) CanDeviceMount(spec *volume.Spec) (bool, error) {
358+
return true, nil
359+
}

pkg/volume/iscsi/attacher.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ func (plugin *iscsiPlugin) CanAttach(spec *volume.Spec) bool {
180180
return true
181181
}
182182

183+
func (plugin *iscsiPlugin) CanDeviceMount(spec *volume.Spec) (bool, error) {
184+
return true, nil
185+
}
186+
183187
func volumeSpecToMounter(spec *volume.Spec, host volume.VolumeHost, targetLocks keymutex.KeyMutex, pod *v1.Pod) (*iscsiDiskMounter, error) {
184188
var secret map[string]string
185189
readOnly, fsType, err := getISCSIVolumeInfo(spec)

pkg/volume/local/local.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ type deviceMounter struct {
253253

254254
var _ volume.DeviceMounter = &deviceMounter{}
255255

256+
func (plugin *localVolumePlugin) CanDeviceMount(spec *volume.Spec) (bool, error) {
257+
return true, nil
258+
}
259+
256260
func (plugin *localVolumePlugin) NewDeviceMounter() (volume.DeviceMounter, error) {
257261
return &deviceMounter{
258262
plugin: plugin,

0 commit comments

Comments
 (0)