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
7f0e04a0
Unverified
Commit
7f0e04a0
authored
Jan 17, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Jan 17, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73043 from davidz627/feature/migrationCommon
Add common functionality required for all in-tree to CSI Migration shim code pieces
parents
c999dc38
384fce6b
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
229 additions
and
0 deletions
+229
-0
testvolumespec.go
pkg/controller/volume/attachdetach/testing/testvolumespec.go
+4
-0
framework_test.go
pkg/controller/volume/persistentvolume/framework_test.go
+4
-0
kube_features.go
pkg/features/kube_features.go
+21
-0
aws_ebs.go
pkg/volume/awsebs/aws_ebs.go
+5
-0
azure_dd.go
pkg/volume/azure_dd/azure_dd.go
+4
-0
azure_file.go
pkg/volume/azure_file/azure_file.go
+4
-0
cephfs.go
pkg/volume/cephfs/cephfs.go
+4
-0
cinder.go
pkg/volume/cinder/cinder.go
+4
-0
configmap.go
pkg/volume/configmap/configmap.go
+4
-0
csi_plugin.go
pkg/volume/csi/csi_plugin.go
+4
-0
downwardapi.go
pkg/volume/downwardapi/downwardapi.go
+4
-0
empty_dir.go
pkg/volume/emptydir/empty_dir.go
+4
-0
fc.go
pkg/volume/fc/fc.go
+4
-0
plugin.go
pkg/volume/flexvolume/plugin.go
+4
-0
flocker.go
pkg/volume/flocker/flocker.go
+4
-0
gce_pd.go
pkg/volume/gcepd/gce_pd.go
+5
-0
git_repo.go
pkg/volume/git_repo/git_repo.go
+4
-0
glusterfs.go
pkg/volume/glusterfs/glusterfs.go
+4
-0
host_path.go
pkg/volume/host_path/host_path.go
+4
-0
iscsi.go
pkg/volume/iscsi/iscsi.go
+4
-0
local.go
pkg/volume/local/local.go
+4
-0
nfs.go
pkg/volume/nfs/nfs.go
+4
-0
noop_expandable_plugin.go
pkg/volume/noop_expandable_plugin.go
+4
-0
photon_pd.go
pkg/volume/photon_pd/photon_pd.go
+4
-0
plugins.go
pkg/volume/plugins.go
+35
-0
plugins_test.go
pkg/volume/plugins_test.go
+4
-0
portworx.go
pkg/volume/portworx/portworx.go
+4
-0
projected.go
pkg/volume/projected/projected.go
+4
-0
quobyte.go
pkg/volume/quobyte/quobyte.go
+4
-0
rbd.go
pkg/volume/rbd/rbd.go
+4
-0
sio_plugin.go
pkg/volume/scaleio/sio_plugin.go
+4
-0
secret.go
pkg/volume/secret/secret.go
+4
-0
storageos.go
pkg/volume/storageos/storageos.go
+4
-0
testing.go
pkg/volume/testing/testing.go
+12
-0
BUILD
pkg/volume/util/operationexecutor/BUILD
+1
-0
operation_generator.go
pkg/volume/util/operationexecutor/operation_generator.go
+30
-0
vsphere_volume.go
pkg/volume/vsphere_volume/vsphere_volume.go
+4
-0
No files found.
pkg/controller/volume/attachdetach/testing/testvolumespec.go
View file @
7f0e04a0
...
...
@@ -253,6 +253,10 @@ func (plugin *TestPlugin) CanSupport(spec *volume.Spec) bool {
return
true
}
func
(
plugin
*
TestPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
TestPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/controller/volume/persistentvolume/framework_test.go
View file @
7f0e04a0
...
...
@@ -1258,6 +1258,10 @@ func (plugin *mockVolumePlugin) CanSupport(spec *vol.Spec) bool {
return
true
}
func
(
plugin
*
mockVolumePlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
mockVolumePlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/features/kube_features.go
View file @
7f0e04a0
...
...
@@ -390,6 +390,24 @@ const (
//
// Enables the kubelet's pod resources grpc endpoint
KubeletPodResources
utilfeature
.
Feature
=
"KubeletPodResources"
// owner: @davidz627
// alpha: v1.14
//
// Enables the in-tree storage to CSI Plugin migration feature.
CSIMigration
utilfeature
.
Feature
=
"CSIMigration"
// owner: @davidz627
// alpha: v1.14
//
// Enables the GCE PD in-tree driver to GCE CSI Driver migration feature.
CSIMigrationGCE
utilfeature
.
Feature
=
"CSIMigrationGCE"
// owner: @leakingtapan
// alpha: v1.14
//
// Enables the AWS EBS in-tree driver to AWS EBS CSI Driver migration feature.
CSIMigrationAWS
utilfeature
.
Feature
=
"CSIMigrationAWS"
)
func
init
()
{
...
...
@@ -442,6 +460,9 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
BoundServiceAccountTokenVolume
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CRIContainerLogRotation
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
GCERegionalPersistentDisk
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
CSIMigration
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CSIMigrationGCE
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CSIMigrationAWS
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
RunAsGroup
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
VolumeSubpath
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
BalanceAttachedNodeVolumes
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
...
...
pkg/volume/awsebs/aws_ebs.go
View file @
7f0e04a0
...
...
@@ -86,6 +86,11 @@ func (plugin *awsElasticBlockStorePlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
AWSElasticBlockStore
!=
nil
)
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
IsMigratedToCSI
()
bool
{
return
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigrationAWS
)
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/azure_dd/azure_dd.go
View file @
7f0e04a0
...
...
@@ -121,6 +121,10 @@ func (plugin *azureDataDiskPlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
AzureDisk
!=
nil
)
}
func
(
plugin
*
azureDataDiskPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
azureDataDiskPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/azure_file/azure_file.go
View file @
7f0e04a0
...
...
@@ -80,6 +80,10 @@ func (plugin *azureFilePlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
AzureFile
!=
nil
)
}
func
(
plugin
*
azureFilePlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
azureFilePlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/cephfs/cephfs.go
View file @
7f0e04a0
...
...
@@ -71,6 +71,10 @@ func (plugin *cephfsPlugin) CanSupport(spec *volume.Spec) bool {
return
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
CephFS
!=
nil
)
||
(
spec
.
PersistentVolume
!=
nil
&&
spec
.
PersistentVolume
.
Spec
.
CephFS
!=
nil
)
}
func
(
plugin
*
cephfsPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
cephfsPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/cinder/cinder.go
View file @
7f0e04a0
...
...
@@ -108,6 +108,10 @@ func (plugin *cinderPlugin) CanSupport(spec *volume.Spec) bool {
return
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
Cinder
!=
nil
)
||
(
spec
.
PersistentVolume
!=
nil
&&
spec
.
PersistentVolume
.
Spec
.
Cinder
!=
nil
)
}
func
(
plugin
*
cinderPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
cinderPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/configmap/configmap.go
View file @
7f0e04a0
...
...
@@ -77,6 +77,10 @@ func (plugin *configMapPlugin) CanSupport(spec *volume.Spec) bool {
return
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
ConfigMap
!=
nil
}
func
(
plugin
*
configMapPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
configMapPlugin
)
RequiresRemount
()
bool
{
return
true
}
...
...
pkg/volume/csi/csi_plugin.go
View file @
7f0e04a0
...
...
@@ -279,6 +279,10 @@ func (p *csiPlugin) CanSupport(spec *volume.Spec) bool {
return
spec
.
PersistentVolume
!=
nil
&&
spec
.
PersistentVolume
.
Spec
.
CSI
!=
nil
}
func
(
p
*
csiPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
p
*
csiPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/downwardapi/downwardapi.go
View file @
7f0e04a0
...
...
@@ -81,6 +81,10 @@ func (plugin *downwardAPIPlugin) CanSupport(spec *volume.Spec) bool {
return
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
DownwardAPI
!=
nil
}
func
(
plugin
*
downwardAPIPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
downwardAPIPlugin
)
RequiresRemount
()
bool
{
return
true
}
...
...
pkg/volume/emptydir/empty_dir.go
View file @
7f0e04a0
...
...
@@ -89,6 +89,10 @@ func (plugin *emptyDirPlugin) CanSupport(spec *volume.Spec) bool {
return
false
}
func
(
plugin
*
emptyDirPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
emptyDirPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/fc/fc.go
View file @
7f0e04a0
...
...
@@ -85,6 +85,10 @@ func (plugin *fcPlugin) CanSupport(spec *volume.Spec) bool {
return
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
FC
!=
nil
)
||
(
spec
.
PersistentVolume
!=
nil
&&
spec
.
PersistentVolume
.
Spec
.
FC
!=
nil
)
}
func
(
plugin
*
fcPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
fcPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/flexvolume/plugin.go
View file @
7f0e04a0
...
...
@@ -149,6 +149,10 @@ func (plugin *flexVolumePlugin) CanSupport(spec *volume.Spec) bool {
return
sourceDriver
==
plugin
.
driverName
}
func
(
plugin
*
flexVolumePlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
// RequiresRemount is part of the volume.VolumePlugin interface.
func
(
plugin
*
flexVolumePlugin
)
RequiresRemount
()
bool
{
return
false
...
...
pkg/volume/flocker/flocker.go
View file @
7f0e04a0
...
...
@@ -108,6 +108,10 @@ func (p *flockerPlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
Flocker
!=
nil
)
}
func
(
p
*
flockerPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
p
*
flockerPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/gcepd/gce_pd.go
View file @
7f0e04a0
...
...
@@ -98,6 +98,11 @@ func (plugin *gcePersistentDiskPlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
GCEPersistentDisk
!=
nil
)
}
func
(
plugin
*
gcePersistentDiskPlugin
)
IsMigratedToCSI
()
bool
{
return
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigrationGCE
)
}
func
(
plugin
*
gcePersistentDiskPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/git_repo/git_repo.go
View file @
7f0e04a0
...
...
@@ -78,6 +78,10 @@ func (plugin *gitRepoPlugin) CanSupport(spec *volume.Spec) bool {
return
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
GitRepo
!=
nil
}
func
(
plugin
*
gitRepoPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
gitRepoPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/glusterfs/glusterfs.go
View file @
7f0e04a0
...
...
@@ -114,6 +114,10 @@ func (plugin *glusterfsPlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
Glusterfs
!=
nil
)
}
func
(
plugin
*
glusterfsPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
glusterfsPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/host_path/host_path.go
View file @
7f0e04a0
...
...
@@ -83,6 +83,10 @@ func (plugin *hostPathPlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
HostPath
!=
nil
)
}
func
(
plugin
*
hostPathPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
hostPathPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/iscsi/iscsi.go
View file @
7f0e04a0
...
...
@@ -76,6 +76,10 @@ func (plugin *iscsiPlugin) CanSupport(spec *volume.Spec) bool {
return
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
ISCSI
!=
nil
)
||
(
spec
.
PersistentVolume
!=
nil
&&
spec
.
PersistentVolume
.
Spec
.
ISCSI
!=
nil
)
}
func
(
plugin
*
iscsiPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
iscsiPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/local/local.go
View file @
7f0e04a0
...
...
@@ -82,6 +82,10 @@ func (plugin *localVolumePlugin) CanSupport(spec *volume.Spec) bool {
return
(
spec
.
PersistentVolume
!=
nil
&&
spec
.
PersistentVolume
.
Spec
.
Local
!=
nil
)
}
func
(
plugin
*
localVolumePlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
localVolumePlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/nfs/nfs.go
View file @
7f0e04a0
...
...
@@ -84,6 +84,10 @@ func (plugin *nfsPlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
NFS
!=
nil
)
}
func
(
plugin
*
nfsPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
nfsPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/noop_expandable_plugin.go
View file @
7f0e04a0
...
...
@@ -48,6 +48,10 @@ func (n *noopExpandableVolumePluginInstance) CanSupport(spec *Spec) bool {
return
true
}
func
(
n
*
noopExpandableVolumePluginInstance
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
n
*
noopExpandableVolumePluginInstance
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/photon_pd/photon_pd.go
View file @
7f0e04a0
...
...
@@ -74,6 +74,10 @@ func (plugin *photonPersistentDiskPlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
PhotonPersistentDisk
!=
nil
)
}
func
(
plugin
*
photonPersistentDiskPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
photonPersistentDiskPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/plugins.go
View file @
7f0e04a0
...
...
@@ -118,6 +118,10 @@ type VolumePlugin interface {
// const.
CanSupport
(
spec
*
Spec
)
bool
// IsMigratedToCSI tests whether a CSIDriver implements this plugin's
// functionality
IsMigratedToCSI
()
bool
// RequiresRemount returns true if this plugin requires mount calls to be
// reexecuted. Atomically updating volumes, like Downward API, depend on
// this to update the contents of the volume.
...
...
@@ -601,6 +605,37 @@ func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error) {
return
matches
[
0
],
nil
}
// IsPluginMigratableBySpec looks for a plugin that can support a given volume
// specification and whether that plugin is Migratable. If no plugins can
// support or more than one plugin can support it, return error.
func
(
pm
*
VolumePluginMgr
)
IsPluginMigratableBySpec
(
spec
*
Spec
)
(
bool
,
error
)
{
pm
.
mutex
.
Lock
()
defer
pm
.
mutex
.
Unlock
()
if
spec
==
nil
{
return
false
,
fmt
.
Errorf
(
"could not find if plugin is migratable because volume spec is nil"
)
}
matchedPluginNames
:=
[]
string
{}
matches
:=
[]
VolumePlugin
{}
for
k
,
v
:=
range
pm
.
plugins
{
if
v
.
CanSupport
(
spec
)
{
matchedPluginNames
=
append
(
matchedPluginNames
,
k
)
matches
=
append
(
matches
,
v
)
}
}
if
len
(
matches
)
==
0
{
// Not a known plugin (flex) in which case it is not migratable
return
false
,
nil
}
if
len
(
matches
)
>
1
{
return
false
,
fmt
.
Errorf
(
"multiple volume plugins matched: %s"
,
strings
.
Join
(
matchedPluginNames
,
","
))
}
return
matches
[
0
]
.
IsMigratedToCSI
(),
nil
}
// FindPluginByName fetches a plugin by name or by legacy name. If no plugin
// is found, returns error.
func
(
pm
*
VolumePluginMgr
)
FindPluginByName
(
name
string
)
(
VolumePlugin
,
error
)
{
...
...
pkg/volume/plugins_test.go
View file @
7f0e04a0
...
...
@@ -75,6 +75,10 @@ func (plugin *testPlugins) CanSupport(spec *Spec) bool {
return
true
}
func
(
plugin
*
testPlugins
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
testPlugins
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/portworx/portworx.go
View file @
7f0e04a0
...
...
@@ -95,6 +95,10 @@ func (plugin *portworxVolumePlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
PortworxVolume
!=
nil
)
}
func
(
plugin
*
portworxVolumePlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
portworxVolumePlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/projected/projected.go
View file @
7f0e04a0
...
...
@@ -96,6 +96,10 @@ func (plugin *projectedPlugin) CanSupport(spec *volume.Spec) bool {
return
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
Projected
!=
nil
}
func
(
plugin
*
projectedPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
projectedPlugin
)
RequiresRemount
()
bool
{
return
true
}
...
...
pkg/volume/quobyte/quobyte.go
View file @
7f0e04a0
...
...
@@ -110,6 +110,10 @@ func (plugin *quobytePlugin) CanSupport(spec *volume.Spec) bool {
return
false
}
func
(
plugin
*
quobytePlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
quobytePlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/rbd/rbd.go
View file @
7f0e04a0
...
...
@@ -107,6 +107,10 @@ func (plugin *rbdPlugin) CanSupport(spec *volume.Spec) bool {
return
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
RBD
!=
nil
)
||
(
spec
.
PersistentVolume
!=
nil
&&
spec
.
PersistentVolume
.
Spec
.
RBD
!=
nil
)
}
func
(
plugin
*
rbdPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
rbdPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/scaleio/sio_plugin.go
View file @
7f0e04a0
...
...
@@ -72,6 +72,10 @@ func (p *sioPlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
ScaleIO
!=
nil
)
}
func
(
p
*
sioPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
p
*
sioPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/secret/secret.go
View file @
7f0e04a0
...
...
@@ -80,6 +80,10 @@ func (plugin *secretPlugin) CanSupport(spec *volume.Spec) bool {
return
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
Secret
!=
nil
}
func
(
plugin
*
secretPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
secretPlugin
)
RequiresRemount
()
bool
{
return
true
}
...
...
pkg/volume/storageos/storageos.go
View file @
7f0e04a0
...
...
@@ -91,6 +91,10 @@ func (plugin *storageosPlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
StorageOS
!=
nil
)
}
func
(
plugin
*
storageosPlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
storageosPlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/testing/testing.go
View file @
7f0e04a0
...
...
@@ -313,6 +313,10 @@ func (plugin *FakeVolumePlugin) CanSupport(spec *Spec) bool {
return
true
}
func
(
plugin
*
FakeVolumePlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
FakeVolumePlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
@@ -526,6 +530,10 @@ func (f *FakeBasicVolumePlugin) CanSupport(spec *Spec) bool {
return
strings
.
HasPrefix
(
spec
.
Name
(),
f
.
GetPluginName
())
}
func
(
plugin
*
FakeBasicVolumePlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
f
*
FakeBasicVolumePlugin
)
ConstructVolumeSpec
(
ame
,
mountPath
string
)
(
*
Spec
,
error
)
{
return
f
.
Plugin
.
ConstructVolumeSpec
(
ame
,
mountPath
)
}
...
...
@@ -611,6 +619,10 @@ func (plugin *FakeFileVolumePlugin) CanSupport(spec *Spec) bool {
return
true
}
func
(
plugin
*
FakeFileVolumePlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
FakeFileVolumePlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
pkg/volume/util/operationexecutor/BUILD
View file @
7f0e04a0
...
...
@@ -30,6 +30,7 @@ go_library(
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
"//staging/src/k8s.io/csi-translation-lib:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)
...
...
pkg/volume/util/operationexecutor/operation_generator.go
View file @
7f0e04a0
...
...
@@ -29,6 +29,7 @@ import (
utilfeature
"k8s.io/apiserver/pkg/util/feature"
clientset
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/record"
csilib
"k8s.io/csi-translation-lib"
"k8s.io/klog"
expandcache
"k8s.io/kubernetes/pkg/controller/volume/expand/cache"
"k8s.io/kubernetes/pkg/features"
...
...
@@ -1437,3 +1438,32 @@ func isDeviceOpened(deviceToDetach AttachedVolume, mounter mount.Interface) (boo
}
return
deviceOpened
,
nil
}
// TODO(dyzz): need to also add logic to check CSINodeInfo for Kubelet migration status
func
useCSIPlugin
(
vpm
*
volume
.
VolumePluginMgr
,
spec
*
volume
.
Spec
)
bool
{
if
csilib
.
IsPVMigratable
(
spec
.
PersistentVolume
)
||
csilib
.
IsInlineMigratable
(
spec
.
Volume
)
{
migratable
,
err
:=
vpm
.
IsPluginMigratableBySpec
(
spec
)
if
err
==
nil
&&
migratable
{
return
true
}
}
return
false
}
func
translateSpec
(
spec
*
volume
.
Spec
)
(
*
volume
.
Spec
,
error
)
{
if
spec
.
PersistentVolume
!=
nil
{
// TranslateInTreePVToCSI will create a new PV
csiPV
,
err
:=
csilib
.
TranslateInTreePVToCSI
(
spec
.
PersistentVolume
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to translate in tree pv to CSI: %v"
,
err
)
}
return
&
volume
.
Spec
{
PersistentVolume
:
csiPV
,
ReadOnly
:
spec
.
ReadOnly
,
},
nil
}
else
if
spec
.
Volume
!=
nil
{
return
&
volume
.
Spec
{},
fmt
.
Errorf
(
"translation is not supported for in-line volumes yet"
)
}
else
{
return
&
volume
.
Spec
{},
fmt
.
Errorf
(
"not a valid volume spec"
)
}
}
pkg/volume/vsphere_volume/vsphere_volume.go
View file @
7f0e04a0
...
...
@@ -81,6 +81,10 @@ func (plugin *vsphereVolumePlugin) CanSupport(spec *volume.Spec) bool {
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
VsphereVolume
!=
nil
)
}
func
(
plugin
*
vsphereVolumePlugin
)
IsMigratedToCSI
()
bool
{
return
false
}
func
(
plugin
*
vsphereVolumePlugin
)
RequiresRemount
()
bool
{
return
false
}
...
...
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