Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3777514f
Commit
3777514f
authored
Mar 28, 2019
by
Vladimir Vivien
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds DeviceMountablePlugin.CanDeviceMount check when retrieving plugins
parent
1514bb21
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
68 additions
and
1 deletion
+68
-1
testvolumespec.go
pkg/controller/volume/attachdetach/testing/testvolumespec.go
+4
-0
attacher.go
pkg/volume/awsebs/attacher.go
+4
-0
azure_dd.go
pkg/volume/azure_dd/azure_dd.go
+4
-0
attacher.go
pkg/volume/cinder/attacher.go
+4
-0
csi_plugin.go
pkg/volume/csi/csi_plugin.go
+5
-0
attacher.go
pkg/volume/fc/attacher.go
+4
-0
plugin.go
pkg/volume/flexvolume/plugin.go
+4
-0
attacher.go
pkg/volume/gcepd/attacher.go
+4
-0
attacher.go
pkg/volume/iscsi/attacher.go
+4
-0
local.go
pkg/volume/local/local.go
+4
-0
attacher.go
pkg/volume/photon_pd/attacher.go
+4
-0
plugins.go
pkg/volume/plugins.go
+7
-1
attacher.go
pkg/volume/rbd/attacher.go
+4
-0
testing.go
pkg/volume/testing/testing.go
+8
-0
attacher.go
pkg/volume/vsphere_volume/attacher.go
+4
-0
No files found.
pkg/controller/volume/attachdetach/testing/testvolumespec.go
View file @
3777514f
...
@@ -312,6 +312,10 @@ func (plugin *TestPlugin) CanAttach(spec *volume.Spec) bool {
...
@@ -312,6 +312,10 @@ func (plugin *TestPlugin) CanAttach(spec *volume.Spec) bool {
return
true
return
true
}
}
func
(
plugin
*
TestPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
func
(
plugin
*
TestPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
func
(
plugin
*
TestPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
return
plugin
.
NewDetacher
()
}
}
...
...
pkg/volume/awsebs/attacher.go
View file @
3777514f
...
@@ -281,6 +281,10 @@ func (plugin *awsElasticBlockStorePlugin) CanAttach(spec *volume.Spec) bool {
...
@@ -281,6 +281,10 @@ func (plugin *awsElasticBlockStorePlugin) CanAttach(spec *volume.Spec) bool {
return
true
return
true
}
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
func
setNodeDisk
(
func
setNodeDisk
(
nodeDiskMap
map
[
types
.
NodeName
]
map
[
*
volume
.
Spec
]
bool
,
nodeDiskMap
map
[
types
.
NodeName
]
map
[
*
volume
.
Spec
]
bool
,
volumeSpec
*
volume
.
Spec
,
volumeSpec
*
volume
.
Spec
,
...
...
pkg/volume/azure_dd/azure_dd.go
View file @
3777514f
...
@@ -242,6 +242,10 @@ func (plugin *azureDataDiskPlugin) CanAttach(spec *volume.Spec) bool {
...
@@ -242,6 +242,10 @@ func (plugin *azureDataDiskPlugin) CanAttach(spec *volume.Spec) bool {
return
true
return
true
}
}
func
(
plugin
*
azureDataDiskPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
func
(
plugin
*
azureDataDiskPlugin
)
NewDeleter
(
spec
*
volume
.
Spec
)
(
volume
.
Deleter
,
error
)
{
func
(
plugin
*
azureDataDiskPlugin
)
NewDeleter
(
spec
*
volume
.
Spec
)
(
volume
.
Deleter
,
error
)
{
volumeSource
,
_
,
err
:=
getVolumeSource
(
spec
)
volumeSource
,
_
,
err
:=
getVolumeSource
(
spec
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/volume/cinder/attacher.go
View file @
3777514f
...
@@ -410,6 +410,10 @@ func (plugin *cinderPlugin) CanAttach(spec *volume.Spec) bool {
...
@@ -410,6 +410,10 @@ func (plugin *cinderPlugin) CanAttach(spec *volume.Spec) bool {
return
true
return
true
}
}
func
(
plugin
*
cinderPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
func
(
attacher
*
cinderDiskAttacher
)
nodeInstanceID
(
nodeName
types
.
NodeName
)
(
string
,
error
)
{
func
(
attacher
*
cinderDiskAttacher
)
nodeInstanceID
(
nodeName
types
.
NodeName
)
(
string
,
error
)
{
instances
,
res
:=
attacher
.
cinderProvider
.
Instances
()
instances
,
res
:=
attacher
.
cinderProvider
.
Instances
()
if
!
res
{
if
!
res
{
...
...
pkg/volume/csi/csi_plugin.go
View file @
3777514f
...
@@ -604,6 +604,11 @@ func (p *csiPlugin) CanAttach(spec *volume.Spec) bool {
...
@@ -604,6 +604,11 @@ func (p *csiPlugin) CanAttach(spec *volume.Spec) bool {
return
!
skipAttach
return
!
skipAttach
}
}
// TODO (#75352) add proper logic to determine device moutability by inspecting the spec.
func
(
p
*
csiPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
func
(
p
*
csiPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
func
(
p
*
csiPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
p
.
NewDetacher
()
return
p
.
NewDetacher
()
}
}
...
...
pkg/volume/fc/attacher.go
View file @
3777514f
...
@@ -179,6 +179,10 @@ func (plugin *fcPlugin) CanAttach(spec *volume.Spec) bool {
...
@@ -179,6 +179,10 @@ func (plugin *fcPlugin) CanAttach(spec *volume.Spec) bool {
return
true
return
true
}
}
func
(
plugin
*
fcPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
func
volumeSpecToMounter
(
spec
*
volume
.
Spec
,
host
volume
.
VolumeHost
)
(
*
fcDiskMounter
,
error
)
{
func
volumeSpecToMounter
(
spec
*
volume
.
Spec
,
host
volume
.
VolumeHost
)
(
*
fcDiskMounter
,
error
)
{
fc
,
readOnly
,
err
:=
getVolumeSource
(
spec
)
fc
,
readOnly
,
err
:=
getVolumeSource
(
spec
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/volume/flexvolume/plugin.go
View file @
3777514f
...
@@ -260,6 +260,10 @@ func (plugin *flexVolumeAttachablePlugin) CanAttach(spec *volume.Spec) bool {
...
@@ -260,6 +260,10 @@ func (plugin *flexVolumeAttachablePlugin) CanAttach(spec *volume.Spec) bool {
return
true
return
true
}
}
func
(
plugin
*
flexVolumeAttachablePlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
// ConstructVolumeSpec is part of the volume.AttachableVolumePlugin interface.
// ConstructVolumeSpec is part of the volume.AttachableVolumePlugin interface.
func
(
plugin
*
flexVolumePlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
func
(
plugin
*
flexVolumePlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
flexVolume
:=
&
api
.
Volume
{
flexVolume
:=
&
api
.
Volume
{
...
...
pkg/volume/gcepd/attacher.go
View file @
3777514f
...
@@ -353,3 +353,7 @@ func (detacher *gcePersistentDiskDetacher) UnmountDevice(deviceMountPath string)
...
@@ -353,3 +353,7 @@ func (detacher *gcePersistentDiskDetacher) UnmountDevice(deviceMountPath string)
func
(
plugin
*
gcePersistentDiskPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
gcePersistentDiskPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
return
true
return
true
}
}
func
(
plugin
*
gcePersistentDiskPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
pkg/volume/iscsi/attacher.go
View file @
3777514f
...
@@ -180,6 +180,10 @@ func (plugin *iscsiPlugin) CanAttach(spec *volume.Spec) bool {
...
@@ -180,6 +180,10 @@ func (plugin *iscsiPlugin) CanAttach(spec *volume.Spec) bool {
return
true
return
true
}
}
func
(
plugin
*
iscsiPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
func
volumeSpecToMounter
(
spec
*
volume
.
Spec
,
host
volume
.
VolumeHost
,
targetLocks
keymutex
.
KeyMutex
,
pod
*
v1
.
Pod
)
(
*
iscsiDiskMounter
,
error
)
{
func
volumeSpecToMounter
(
spec
*
volume
.
Spec
,
host
volume
.
VolumeHost
,
targetLocks
keymutex
.
KeyMutex
,
pod
*
v1
.
Pod
)
(
*
iscsiDiskMounter
,
error
)
{
var
secret
map
[
string
]
string
var
secret
map
[
string
]
string
readOnly
,
fsType
,
err
:=
getISCSIVolumeInfo
(
spec
)
readOnly
,
fsType
,
err
:=
getISCSIVolumeInfo
(
spec
)
...
...
pkg/volume/local/local.go
View file @
3777514f
...
@@ -253,6 +253,10 @@ type deviceMounter struct {
...
@@ -253,6 +253,10 @@ type deviceMounter struct {
var
_
volume
.
DeviceMounter
=
&
deviceMounter
{}
var
_
volume
.
DeviceMounter
=
&
deviceMounter
{}
func
(
plugin
*
localVolumePlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
func
(
plugin
*
localVolumePlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
func
(
plugin
*
localVolumePlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
&
deviceMounter
{
return
&
deviceMounter
{
plugin
:
plugin
,
plugin
:
plugin
,
...
...
pkg/volume/photon_pd/attacher.go
View file @
3777514f
...
@@ -311,3 +311,7 @@ func (detacher *photonPersistentDiskDetacher) UnmountDevice(deviceMountPath stri
...
@@ -311,3 +311,7 @@ func (detacher *photonPersistentDiskDetacher) UnmountDevice(deviceMountPath stri
func
(
plugin
*
photonPersistentDiskPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
photonPersistentDiskPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
return
true
return
true
}
}
func
(
plugin
*
photonPersistentDiskPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
pkg/volume/plugins.go
View file @
3777514f
...
@@ -241,6 +241,8 @@ type DeviceMountableVolumePlugin interface {
...
@@ -241,6 +241,8 @@ type DeviceMountableVolumePlugin interface {
NewDeviceMounter
()
(
DeviceMounter
,
error
)
NewDeviceMounter
()
(
DeviceMounter
,
error
)
NewDeviceUnmounter
()
(
DeviceUnmounter
,
error
)
NewDeviceUnmounter
()
(
DeviceUnmounter
,
error
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
// CanDeviceMount determines if device in volume.Spec is mountable
CanDeviceMount
(
spec
*
Spec
)
(
bool
,
error
)
}
}
// ExpandableVolumePlugin is an extended interface of VolumePlugin and is used for volumes that can be
// ExpandableVolumePlugin is an extended interface of VolumePlugin and is used for volumes that can be
...
@@ -902,7 +904,11 @@ func (pm *VolumePluginMgr) FindDeviceMountablePluginBySpec(spec *Spec) (DeviceMo
...
@@ -902,7 +904,11 @@ func (pm *VolumePluginMgr) FindDeviceMountablePluginBySpec(spec *Spec) (DeviceMo
return
nil
,
err
return
nil
,
err
}
}
if
deviceMountableVolumePlugin
,
ok
:=
volumePlugin
.
(
DeviceMountableVolumePlugin
);
ok
{
if
deviceMountableVolumePlugin
,
ok
:=
volumePlugin
.
(
DeviceMountableVolumePlugin
);
ok
{
return
deviceMountableVolumePlugin
,
nil
if
canMount
,
err
:=
deviceMountableVolumePlugin
.
CanDeviceMount
(
spec
);
err
!=
nil
{
return
nil
,
err
}
else
if
canMount
{
return
deviceMountableVolumePlugin
,
nil
}
}
}
return
nil
,
nil
return
nil
,
nil
}
}
...
...
pkg/volume/rbd/attacher.go
View file @
3777514f
...
@@ -75,6 +75,10 @@ func (plugin *rbdPlugin) CanAttach(spec *volume.Spec) bool {
...
@@ -75,6 +75,10 @@ func (plugin *rbdPlugin) CanAttach(spec *volume.Spec) bool {
return
true
return
true
}
}
func
(
plugin
*
rbdPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
// rbdAttacher implements volume.Attacher interface.
// rbdAttacher implements volume.Attacher interface.
type
rbdAttacher
struct
{
type
rbdAttacher
struct
{
plugin
*
rbdPlugin
plugin
*
rbdPlugin
...
...
pkg/volume/testing/testing.go
View file @
3777514f
...
@@ -488,6 +488,10 @@ func (plugin *FakeVolumePlugin) CanAttach(spec *Spec) bool {
...
@@ -488,6 +488,10 @@ func (plugin *FakeVolumePlugin) CanAttach(spec *Spec) bool {
return
true
return
true
}
}
func
(
plugin
*
FakeVolumePlugin
)
CanDeviceMount
(
spec
*
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
func
(
plugin
*
FakeVolumePlugin
)
Recycle
(
pvName
string
,
spec
*
Spec
,
eventRecorder
recyclerclient
.
RecycleEventRecorder
)
error
{
func
(
plugin
*
FakeVolumePlugin
)
Recycle
(
pvName
string
,
spec
*
Spec
,
eventRecorder
recyclerclient
.
RecycleEventRecorder
)
error
{
return
nil
return
nil
}
}
...
@@ -610,6 +614,10 @@ type FakeDeviceMountableVolumePlugin struct {
...
@@ -610,6 +614,10 @@ type FakeDeviceMountableVolumePlugin struct {
FakeBasicVolumePlugin
FakeBasicVolumePlugin
}
}
func
(
f
*
FakeDeviceMountableVolumePlugin
)
CanDeviceMount
(
spec
*
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
func
(
f
*
FakeDeviceMountableVolumePlugin
)
NewDeviceMounter
()
(
DeviceMounter
,
error
)
{
func
(
f
*
FakeDeviceMountableVolumePlugin
)
NewDeviceMounter
()
(
DeviceMounter
,
error
)
{
return
f
.
Plugin
.
NewDeviceMounter
()
return
f
.
Plugin
.
NewDeviceMounter
()
}
}
...
...
pkg/volume/vsphere_volume/attacher.go
View file @
3777514f
...
@@ -299,6 +299,10 @@ func (plugin *vsphereVolumePlugin) CanAttach(spec *volume.Spec) bool {
...
@@ -299,6 +299,10 @@ func (plugin *vsphereVolumePlugin) CanAttach(spec *volume.Spec) bool {
return
true
return
true
}
}
func
(
plugin
*
vsphereVolumePlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
,
nil
}
func
setNodeVolume
(
func
setNodeVolume
(
nodeVolumeMap
map
[
types
.
NodeName
]
map
[
*
volume
.
Spec
]
bool
,
nodeVolumeMap
map
[
types
.
NodeName
]
map
[
*
volume
.
Spec
]
bool
,
volumeSpec
*
volume
.
Spec
,
volumeSpec
*
volume
.
Spec
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment