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
14bf63ed
Commit
14bf63ed
authored
Apr 07, 2019
by
Darren Shepherd
Committed by
root
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove CSI Alpha features
parent
5f3fb4c8
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
12 additions
and
236 deletions
+12
-236
plugins.go
cmd/kube-controller-manager/app/plugins.go
+0
-4
util.go
pkg/api/pod/util.go
+1
-1
util.go
pkg/api/podsecuritypolicy/util.go
+1
-3
attach_detach_controller.go
...ontroller/volume/attachdetach/attach_detach_controller.go
+0
-8
kube_features.go
pkg/features/kube_features.go
+0
-41
csi_mounter.go
pkg/volume/csi/csi_mounter.go
+1
-17
csi_plugin.go
pkg/volume/csi/csi_plugin.go
+3
-114
csi_util.go
pkg/volume/csi/csi_util.go
+0
-5
expander.go
pkg/volume/csi/expander.go
+2
-10
operation_generator.go
pkg/volume/util/operationexecutor/operation_generator.go
+4
-30
controller_policy.go
...auth/authorizer/rbac/bootstrappolicy/controller_policy.go
+0
-3
No files found.
cmd/kube-controller-manager/app/plugins.go
View file @
14bf63ed
...
...
@@ -106,10 +106,6 @@ func ProbeControllerVolumePlugins(config kubectrlmgrconfig.VolumeConfiguration)
allPlugins
=
append
(
allPlugins
,
nfs
.
ProbeVolumePlugins
(
nfsConfig
)
...
)
allPlugins
=
append
(
allPlugins
,
local
.
ProbeVolumePlugins
()
...
)
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIInlineVolume
)
{
allPlugins
=
append
(
allPlugins
,
csi
.
ProbeVolumePlugins
()
...
)
}
return
allPlugins
}
...
...
pkg/api/pod/util.go
View file @
14bf63ed
...
...
@@ -433,7 +433,7 @@ func dropDisabledVolumeDevicesFields(podSpec, oldPodSpec *api.PodSpec) {
// dropDisabledCSIVolumeSourceAlphaFields removes disabled alpha fields from []CSIVolumeSource.
// This should be called from PrepareForCreate/PrepareForUpdate for all pod specs resources containing a CSIVolumeSource
func
dropDisabledCSIVolumeSourceAlphaFields
(
podSpec
,
oldPodSpec
*
api
.
PodSpec
)
{
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIInlineVolume
)
&&
!
csiInUse
(
oldPodSpec
)
{
if
!
csiInUse
(
oldPodSpec
)
{
for
i
:=
range
podSpec
.
Volumes
{
podSpec
.
Volumes
[
i
]
.
CSI
=
nil
}
...
...
pkg/api/podsecuritypolicy/util.go
View file @
14bf63ed
...
...
@@ -35,9 +35,7 @@ func DropDisabledFields(pspSpec, oldPSPSpec *policy.PodSecurityPolicySpec) {
pspSpec
.
AllowedUnsafeSysctls
=
nil
pspSpec
.
ForbiddenSysctls
=
nil
}
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIInlineVolume
)
{
pspSpec
.
AllowedCSIDrivers
=
nil
}
pspSpec
.
AllowedCSIDrivers
=
nil
}
func
allowedProcMountTypesInUse
(
oldPSPSpec
*
policy
.
PodSecurityPolicySpec
)
bool
{
...
...
pkg/controller/volume/attachdetach/attach_detach_controller.go
View file @
14bf63ed
...
...
@@ -30,7 +30,6 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
coreinformers
"k8s.io/client-go/informers/core/v1"
storageinformers
"k8s.io/client-go/informers/storage/v1beta1"
clientset
"k8s.io/client-go/kubernetes"
...
...
@@ -49,7 +48,6 @@ import (
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/reconciler"
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/statusupdater"
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/util"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
...
...
@@ -138,12 +136,6 @@ func NewAttachDetachController(
pvcQueue
:
workqueue
.
NewNamedRateLimitingQueue
(
workqueue
.
DefaultControllerRateLimiter
(),
"pvcs"
),
}
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSINodeInfo
)
{
adc
.
csiNodeLister
=
csiNodeInformer
.
Lister
()
adc
.
csiNodeSynced
=
csiNodeInformer
.
Informer
()
.
HasSynced
}
if
err
:=
adc
.
volumePluginMgr
.
InitPlugins
(
plugins
,
prober
,
adc
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Could not initialize volume plugins for Attach/Detach Controller: %+v"
,
err
)
}
...
...
pkg/features/kube_features.go
View file @
14bf63ed
...
...
@@ -94,11 +94,6 @@ const (
// Ability to Expand persistent volumes
ExpandPersistentVolumes
utilfeature
.
Feature
=
"ExpandPersistentVolumes"
// owner: @gnufied
// alpha: v1.14
// Ability to expand CSI volumes
ExpandCSIVolumes
utilfeature
.
Feature
=
"ExpandCSIVolumes"
// owner: @verb
// beta: v1.12
//
...
...
@@ -267,12 +262,6 @@ const (
// Enables CSI to use raw block storage volumes
CSIBlockVolume
utilfeature
.
Feature
=
"CSIBlockVolume"
// owner: @vladimirvivien
// alpha: v1.14
//
// Enables CSI Inline volumes support for pods
CSIInlineVolume
utilfeature
.
Feature
=
"CSIInlineVolume"
// owner: @tallclair
// alpha: v1.12
// beta: v1.14
...
...
@@ -286,30 +275,6 @@ const (
// Kubelet uses the new Lease API to report node heartbeats,
// (Kube) Node Lifecycle Controller uses these heartbeats as a node health signal.
NodeLease
utilfeature
.
Feature
=
"NodeLease"
// 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"
// owner: @adisky
// alpha: v1.14
//
// Enables the OpenStack Cinder in-tree driver to OpenStack Cinder CSI Driver migration feature.
CSIMigrationOpenStack
utilfeature
.
Feature
=
"CSIMigrationOpenStack"
)
func
init
()
{
...
...
@@ -335,7 +300,6 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
PodPriority
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
TaintNodesByCondition
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
ExpandPersistentVolumes
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
ExpandCSIVolumes
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
AttachVolumeLimit
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
CPUManager
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
VolumeScheduling
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
,
LockToDefault
:
true
},
// remove in 1.16
...
...
@@ -351,17 +315,12 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
TokenRequest
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
TokenRequestProjection
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
CRIContainerLogRotation
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
CSIMigration
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CSIMigrationGCE
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CSIMigrationAWS
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
RunAsGroup
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
CSIMigrationOpenStack
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
VolumeSubpath
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
PodReadinessGates
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
,
LockToDefault
:
true
},
// remove in 1.16
KubeletPluginsWatcher
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
,
LockToDefault
:
true
},
// remove in 1.16
ResourceQuotaScopeSelectors
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
CSIBlockVolume
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
CSIInlineVolume
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
RuntimeClass
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
NodeLease
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
...
...
pkg/volume/csi/csi_mounter.go
View file @
14bf63ed
...
...
@@ -142,23 +142,7 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error {
switch
{
case
volSrc
!=
nil
:
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIInlineVolume
)
{
return
fmt
.
Errorf
(
"CSIInlineVolume feature required"
)
}
if
c
.
driverMode
!=
ephemeralDriverMode
{
return
fmt
.
Errorf
(
"unexpected driver mode: %s"
,
c
.
driverMode
)
}
if
volSrc
.
FSType
!=
nil
{
fsType
=
*
volSrc
.
FSType
}
volAttribs
=
volSrc
.
VolumeAttributes
if
volSrc
.
NodePublishSecretRef
!=
nil
{
secretName
:=
volSrc
.
NodePublishSecretRef
.
Name
ns
:=
c
.
pod
.
Namespace
secretRef
=
&
api
.
SecretReference
{
Name
:
secretName
,
Namespace
:
ns
}
}
return
fmt
.
Errorf
(
"CSIInlineVolume feature required"
)
case
pvSrc
!=
nil
:
if
c
.
driverMode
!=
persistentDriverMode
{
return
fmt
.
Errorf
(
"unexpected driver mode: %s"
,
c
.
driverMode
)
...
...
pkg/volume/csi/csi_plugin.go
View file @
14bf63ed
...
...
@@ -33,7 +33,6 @@ import (
apierrs
"k8s.io/apimachinery/pkg/api/errors"
meta
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
utilruntime
"k8s.io/apimachinery/pkg/util/runtime"
utilversion
"k8s.io/apimachinery/pkg/util/version"
"k8s.io/apimachinery/pkg/util/wait"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
...
...
@@ -41,7 +40,6 @@ import (
csiinformer
"k8s.io/client-go/informers/storage/v1beta1"
clientset
"k8s.io/client-go/kubernetes"
csilister
"k8s.io/client-go/listers/storage/v1beta1"
csitranslationplugins
"k8s.io/csi-translation-lib/plugins"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/csi/nodeinfomanager"
...
...
@@ -225,84 +223,12 @@ func (p *csiPlugin) Init(host volume.VolumeHost) error {
}
}
var
migratedPlugins
=
map
[
string
](
func
()
bool
){
csitranslationplugins
.
GCEPDInTreePluginName
:
func
()
bool
{
return
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigrationGCE
)
},
csitranslationplugins
.
AWSEBSInTreePluginName
:
func
()
bool
{
return
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigrationAWS
)
},
csitranslationplugins
.
CinderInTreePluginName
:
func
()
bool
{
return
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigrationOpenStack
)
},
}
// Initializing the label management channels
nim
=
nodeinfomanager
.
NewNodeInfoManager
(
host
.
GetNodeName
(),
host
,
migratedPlugins
)
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSINodeInfo
)
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
{
// This function prevents Kubelet from posting Ready status until CSINodeInfo
// is both installed and initialized
if
err
:=
initializeCSINode
(
host
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to initialize CSINodeInfo: %v"
,
err
)
}
}
nim
=
nodeinfomanager
.
NewNodeInfoManager
(
host
.
GetNodeName
(),
host
,
nil
)
return
nil
}
func
initializeCSINode
(
host
volume
.
VolumeHost
)
error
{
kvh
,
ok
:=
host
.
(
volume
.
KubeletVolumeHost
)
if
!
ok
{
klog
.
V
(
4
)
.
Info
(
"Cast from VolumeHost to KubeletVolumeHost failed. Skipping CSINodeInfo initialization, not running on kubelet"
)
return
nil
}
kubeClient
:=
host
.
GetKubeClient
()
if
kubeClient
==
nil
{
// Kubelet running in standalone mode. Skip CSINodeInfo initialization
klog
.
Warning
(
"Skipping CSINodeInfo initialization, kubelet running in standalone mode"
)
return
nil
}
kvh
.
SetKubeletError
(
errors
.
New
(
"CSINodeInfo is not yet initialized"
))
go
func
()
{
defer
utilruntime
.
HandleCrash
()
// Backoff parameters tuned to retry over 140 seconds. Will fail and restart the Kubelet
// after max retry steps.
initBackoff
:=
wait
.
Backoff
{
Steps
:
6
,
Duration
:
15
*
time
.
Millisecond
,
Factor
:
6.0
,
Jitter
:
0.1
,
}
err
:=
wait
.
ExponentialBackoff
(
initBackoff
,
func
()
(
bool
,
error
)
{
klog
.
V
(
4
)
.
Infof
(
"Initializing migrated drivers on CSINodeInfo"
)
err
:=
nim
.
InitializeCSINodeWithAnnotation
()
if
err
!=
nil
{
kvh
.
SetKubeletError
(
fmt
.
Errorf
(
"Failed to initialize CSINodeInfo: %v"
,
err
))
klog
.
Errorf
(
"Failed to initialize CSINodeInfo: %v"
,
err
)
return
false
,
nil
}
// Successfully initialized drivers, allow Kubelet to post Ready
kvh
.
SetKubeletError
(
nil
)
return
true
,
nil
})
if
err
!=
nil
{
// 2 releases after CSIMigration and all CSIMigrationX (where X is a volume plugin)
// are permanently enabled the apiserver/controllers can assume that the kubelet is
// using CSI for all Migrated volume plugins. Then all the CSINode initialization
// code can be dropped from Kubelet.
// Kill the Kubelet process and allow it to restart to retry initialization
klog
.
Fatalf
(
"Failed to initialize CSINodeInfo after retrying"
)
}
}()
return
nil
}
func
(
p
*
csiPlugin
)
GetPluginName
()
string
{
return
CSIPluginName
}
...
...
@@ -326,10 +252,6 @@ func (p *csiPlugin) CanSupport(spec *volume.Spec) bool {
if
spec
==
nil
{
return
false
}
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIInlineVolume
)
{
return
(
spec
.
PersistentVolume
!=
nil
&&
spec
.
PersistentVolume
.
Spec
.
CSI
!=
nil
)
||
(
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
CSI
!=
nil
)
}
return
spec
.
PersistentVolume
!=
nil
&&
spec
.
PersistentVolume
.
Spec
.
CSI
!=
nil
}
...
...
@@ -347,7 +269,7 @@ func (p *csiPlugin) NewMounter(
pod
*
api
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
volSrc
,
pvSrc
,
err
:=
getSourceFromSpec
(
spec
)
_
,
pvSrc
,
err
:=
getSourceFromSpec
(
spec
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -359,12 +281,6 @@ func (p *csiPlugin) NewMounter(
)
switch
{
case
volSrc
!=
nil
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIInlineVolume
)
:
volumeHandle
=
makeVolumeHandle
(
string
(
pod
.
UID
),
spec
.
Name
())
driverName
=
volSrc
.
Driver
if
volSrc
.
ReadOnly
!=
nil
{
readOnly
=
*
volSrc
.
ReadOnly
}
case
pvSrc
!=
nil
:
driverName
=
pvSrc
.
Driver
volumeHandle
=
pvSrc
.
VolumeHandle
...
...
@@ -471,22 +387,7 @@ func (p *csiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.S
klog
.
V
(
4
)
.
Info
(
log
(
"plugin.ConstructVolumeSpec extracted [%#v]"
,
volData
))
var
spec
*
volume
.
Spec
inlineEnabled
:=
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIInlineVolume
)
if
inlineEnabled
{
mode
:=
driverMode
(
volData
[
volDataKey
.
driverMode
])
switch
{
case
mode
==
ephemeralDriverMode
:
spec
=
p
.
constructVolSourceSpec
(
volData
[
volDataKey
.
specVolID
],
volData
[
volDataKey
.
driverName
])
case
mode
==
persistentDriverMode
:
fallthrough
default
:
spec
=
p
.
constructPVSourceSpec
(
volData
[
volDataKey
.
specVolID
],
volData
[
volDataKey
.
driverName
],
volData
[
volDataKey
.
volHandle
])
}
}
else
{
spec
=
p
.
constructPVSourceSpec
(
volData
[
volDataKey
.
specVolID
],
volData
[
volDataKey
.
driverName
],
volData
[
volDataKey
.
volHandle
])
}
spec
=
p
.
constructPVSourceSpec
(
volData
[
volDataKey
.
specVolID
],
volData
[
volDataKey
.
driverName
],
volData
[
volDataKey
.
volHandle
])
return
spec
,
nil
}
...
...
@@ -774,18 +675,6 @@ func (p *csiPlugin) skipAttach(driver string) (bool, error) {
// 2) If Mode cannot be resolved to either {persistent | ephemeral}, an error is returned
// See https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/20190122-csi-inline-volumes.md
func
(
p
*
csiPlugin
)
getDriverMode
(
spec
*
volume
.
Spec
)
(
driverMode
,
error
)
{
// TODO (vladimirvivien) ultimately, mode will be retrieved from CSIDriver.Spec.Mode.
// However, in alpha version, mode is determined by the volume source:
// 1) if volume.Spec.Volume.CSI != nil -> mode is ephemeral
// 2) if volume.Spec.PersistentVolume.Spec.CSI != nil -> persistent
volSrc
,
_
,
err
:=
getSourceFromSpec
(
spec
)
if
err
!=
nil
{
return
""
,
err
}
if
volSrc
!=
nil
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIInlineVolume
)
{
return
ephemeralDriverMode
,
nil
}
return
persistentDriverMode
,
nil
}
...
...
pkg/volume/csi/csi_util.go
View file @
14bf63ed
...
...
@@ -25,10 +25,8 @@ import (
api
"k8s.io/api/core/v1"
meta
"k8s.io/apimachinery/pkg/apis/meta/v1"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/kubernetes"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/volume"
utilstrings
"k8s.io/utils/strings"
)
...
...
@@ -146,9 +144,6 @@ func getSourceFromSpec(spec *volume.Spec) (*api.CSIVolumeSource, *api.CSIPersist
if
spec
.
Volume
!=
nil
&&
spec
.
PersistentVolume
!=
nil
{
return
nil
,
nil
,
fmt
.
Errorf
(
"volume.Spec has both volume and persistent volume sources"
)
}
if
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
CSI
!=
nil
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIInlineVolume
)
{
return
spec
.
Volume
.
CSI
,
nil
,
nil
}
if
spec
.
PersistentVolume
!=
nil
&&
spec
.
PersistentVolume
.
Spec
.
CSI
!=
nil
{
return
nil
,
spec
.
PersistentVolume
.
Spec
.
CSI
,
nil
...
...
pkg/volume/csi/expander.go
View file @
14bf63ed
...
...
@@ -21,23 +21,15 @@ import (
"fmt"
api
"k8s.io/api/core/v1"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/volume"
)
var
_
volume
.
NodeExpandableVolumePlugin
=
&
csiPlugin
{}
func
(
c
*
csiPlugin
)
RequiresFSResize
()
bool
{
// We could check plugin's node capability but we instead are going to rely on
// NodeExpand to do the right thing and return early if plugin does not have
// node expansion capability.
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
ExpandCSIVolumes
)
{
klog
.
V
(
4
)
.
Infof
(
"Resizing is not enabled for CSI volume"
)
return
false
}
return
true
klog
.
V
(
4
)
.
Infof
(
"Resizing is not enabled for CSI volume"
)
return
false
}
func
(
c
*
csiPlugin
)
NodeExpand
(
resizeOptions
volume
.
NodeResizeOptions
)
(
bool
,
error
)
{
...
...
pkg/volume/util/operationexecutor/operation_generator.go
View file @
14bf63ed
...
...
@@ -450,25 +450,9 @@ func (og *operationGenerator) GenerateDetachVolumeFunc(
return
volumetypes
.
GeneratedOperations
{},
volumeToDetach
.
GenerateErrorDetailed
(
"DetachVolume.SplitUniqueName failed"
,
err
)
}
// TODO(dyzz): This case can't distinguish between PV and In-line which is necessary because
// if it was PV it may have been migrated, but the same plugin with in-line may not have been.
// Suggestions welcome...
if
csilib
.
IsMigratableIntreePluginByName
(
pluginName
)
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
{
// The volume represented by this spec is CSI and thus should be migrated
attachableVolumePlugin
,
err
=
og
.
volumePluginMgr
.
FindAttachablePluginByName
(
csi
.
CSIPluginName
)
if
err
!=
nil
||
attachableVolumePlugin
==
nil
{
return
volumetypes
.
GeneratedOperations
{},
volumeToDetach
.
GenerateErrorDetailed
(
"AttachVolume.FindAttachablePluginBySpec failed"
,
err
)
}
// volumeToDetach.VolumeName here is always the in-tree volume name
// therefore a workaround is required. volumeToDetach.DevicePath
// is the attachID which happens to be what volumeName is needed for in Detach.
// Therefore we set volumeName to the attachID. And CSI Detach can detect and use that.
volumeName
=
volumeToDetach
.
DevicePath
}
else
{
attachableVolumePlugin
,
err
=
og
.
volumePluginMgr
.
FindAttachablePluginByName
(
pluginName
)
if
err
!=
nil
||
attachableVolumePlugin
==
nil
{
return
volumetypes
.
GeneratedOperations
{},
volumeToDetach
.
GenerateErrorDetailed
(
"DetachVolume.FindAttachablePluginByName failed"
,
err
)
}
attachableVolumePlugin
,
err
=
og
.
volumePluginMgr
.
FindAttachablePluginByName
(
pluginName
)
if
err
!=
nil
||
attachableVolumePlugin
==
nil
{
return
volumetypes
.
GeneratedOperations
{},
volumeToDetach
.
GenerateErrorDetailed
(
"DetachVolume.FindAttachablePluginByName failed"
,
err
)
}
}
...
...
@@ -1624,15 +1608,6 @@ func useCSIPlugin(vpm *volume.VolumePluginMgr, spec *volume.Spec) bool {
// we can throw a better error when the driver is not installed.
// The error should be of the approximate form:
// fmt.Errorf("in-tree plugin %s is migrated on node %s but driver %s is not installed", pluginName, string(nodeName), driverName)
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
{
return
false
}
if
csilib
.
IsPVMigratable
(
spec
.
PersistentVolume
)
||
csilib
.
IsInlineMigratable
(
spec
.
Volume
)
{
migratable
,
err
:=
vpm
.
IsPluginMigratableBySpec
(
spec
)
if
err
==
nil
&&
migratable
{
return
true
}
}
return
false
}
...
...
@@ -1641,8 +1616,7 @@ func nodeUsingCSIPlugin(og *operationGenerator, spec *volume.Spec, nodeName type
if
err
!=
nil
{
return
false
,
err
}
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
||
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSINodeInfo
)
||
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSINodeInfo
)
||
!
migratable
{
return
false
,
nil
}
...
...
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/controller_policy.go
View file @
14bf63ed
...
...
@@ -76,9 +76,6 @@ func buildControllerRoles() ([]rbacv1.ClusterRole, []rbacv1.ClusterRoleBinding)
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIDriverRegistry
)
{
role
.
Rules
=
append
(
role
.
Rules
,
rbacv1helpers
.
NewRule
(
"get"
,
"watch"
,
"list"
)
.
Groups
(
"storage.k8s.io"
)
.
Resources
(
"csidrivers"
)
.
RuleOrDie
())
}
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSINodeInfo
)
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
{
role
.
Rules
=
append
(
role
.
Rules
,
rbacv1helpers
.
NewRule
(
"get"
,
"watch"
,
"list"
)
.
Groups
(
"storage.k8s.io"
)
.
Resources
(
"csinodes"
)
.
RuleOrDie
())
}
}
return
role
...
...
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