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
4e3bc8cc
Commit
4e3bc8cc
authored
Oct 05, 2018
by
Darren Shepherd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove CSIDriverRegistry
parent
a0d881a5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 addition
and
84 deletions
+1
-84
kube_features.go
pkg/features/kube_features.go
+0
-6
csi_mounter.go
pkg/volume/csi/csi_mounter.go
+1
-34
csi_plugin.go
pkg/volume/csi/csi_plugin.go
+0
-37
controller_policy.go
...auth/authorizer/rbac/bootstrappolicy/controller_policy.go
+0
-3
policy.go
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go
+0
-4
No files found.
pkg/features/kube_features.go
View file @
4e3bc8cc
...
...
@@ -148,11 +148,6 @@ const (
// Enable mount/attachment of Container Storage Interface (CSI) backed PVs
CSIPersistentVolume
utilfeature
.
Feature
=
"CSIPersistentVolume"
// owner: @saad-ali
// alpha: v1.12
// Enable all logic related to the CSIDriver API object in csi.storage.k8s.io
CSIDriverRegistry
utilfeature
.
Feature
=
"CSIDriverRegistry"
// owner: @verult
// alpha: v1.12
// Enable all logic related to the CSINodeInfo API object in csi.storage.k8s.io
...
...
@@ -365,7 +360,6 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
CPUManager
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
VolumeScheduling
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
CSIPersistentVolume
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
CSIDriverRegistry
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CSINodeInfo
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CustomPodDNS
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
BlockVolume
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
...
...
pkg/volume/csi/csi_mounter.go
View file @
4e3bc8cc
...
...
@@ -18,7 +18,6 @@ package csi
import
(
"context"
"errors"
"fmt"
"os"
"path"
...
...
@@ -26,11 +25,8 @@ import (
"k8s.io/klog"
api
"k8s.io/api/core/v1"
apierrs
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/pkg/features"
kstrings
"k8s.io/kubernetes/pkg/util/strings"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
...
...
@@ -236,36 +232,7 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error {
}
func
(
c
*
csiMountMgr
)
podAttributes
()
(
map
[
string
]
string
,
error
)
{
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIDriverRegistry
)
{
return
nil
,
nil
}
if
c
.
plugin
.
csiDriverLister
==
nil
{
return
nil
,
errors
.
New
(
"CSIDriver lister does not exist"
)
}
csiDriver
,
err
:=
c
.
plugin
.
csiDriverLister
.
Get
(
string
(
c
.
driverName
))
if
err
!=
nil
{
if
apierrs
.
IsNotFound
(
err
)
{
klog
.
V
(
4
)
.
Infof
(
log
(
"CSIDriver %q not found, not adding pod information"
,
c
.
driverName
))
return
nil
,
nil
}
return
nil
,
err
}
// if PodInfoOnMountVersion is not set or not v1 we do not set pod attributes
if
csiDriver
.
Spec
.
PodInfoOnMountVersion
==
nil
||
*
csiDriver
.
Spec
.
PodInfoOnMountVersion
!=
currentPodInfoMountVersion
{
klog
.
V
(
4
)
.
Infof
(
log
(
"CSIDriver %q does not require pod information"
,
c
.
driverName
))
return
nil
,
nil
}
attrs
:=
map
[
string
]
string
{
"csi.storage.k8s.io/pod.name"
:
c
.
pod
.
Name
,
"csi.storage.k8s.io/pod.namespace"
:
c
.
pod
.
Namespace
,
"csi.storage.k8s.io/pod.uid"
:
string
(
c
.
pod
.
UID
),
"csi.storage.k8s.io/serviceAccount.name"
:
c
.
pod
.
Spec
.
ServiceAccountName
,
}
klog
.
V
(
4
)
.
Infof
(
log
(
"CSIDriver %q requires pod information"
,
c
.
driverName
))
return
attrs
,
nil
return
nil
,
nil
}
func
(
c
*
csiMountMgr
)
GetAttributes
()
volume
.
Attributes
{
...
...
pkg/volume/csi/csi_plugin.go
View file @
4e3bc8cc
...
...
@@ -31,16 +31,11 @@ import (
"k8s.io/klog"
api
"k8s.io/api/core/v1"
apierrs
"k8s.io/apimachinery/pkg/api/errors"
meta
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
utilversion
"k8s.io/apimachinery/pkg/util/version"
"k8s.io/apimachinery/pkg/util/wait"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
clientset
"k8s.io/client-go/kubernetes"
csiapiinformer
"k8s.io/csi-api/pkg/client/informers/externalversions"
csiinformer
"k8s.io/csi-api/pkg/client/informers/externalversions/csi/v1alpha1"
csilister
"k8s.io/csi-api/pkg/client/listers/csi/v1alpha1"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/csi/nodeinfomanager"
...
...
@@ -68,8 +63,6 @@ var deprecatedSocketDirVersions = []string{"0.1.0", "0.2.0", "0.3.0", "0.4.0"}
type
csiPlugin
struct
{
host
volume
.
VolumeHost
blockEnabled
bool
csiDriverLister
csilister
.
CSIDriverLister
csiDriverInformer
csiinformer
.
CSIDriverInformer
}
// ProbeVolumePlugins returns implemented plugins
...
...
@@ -233,19 +226,6 @@ func (h *RegistrationHandler) DeRegisterPlugin(pluginName string) {
func
(
p
*
csiPlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
p
.
host
=
host
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIDriverRegistry
)
{
csiClient
:=
host
.
GetCSIClient
()
if
csiClient
==
nil
{
klog
.
Warning
(
"The client for CSI Custom Resources is not available, skipping informer initialization"
)
}
else
{
// Start informer for CSIDrivers.
factory
:=
csiapiinformer
.
NewSharedInformerFactory
(
csiClient
,
csiResyncPeriod
)
p
.
csiDriverInformer
=
factory
.
Csi
()
.
V1alpha1
()
.
CSIDrivers
()
p
.
csiDriverLister
=
p
.
csiDriverInformer
.
Lister
()
go
factory
.
Start
(
wait
.
NeverStop
)
}
}
// Initializing csiDrivers map and label management channels
csiDrivers
=
csiDriversStore
{
driversMap
:
map
[
string
]
csiDriver
{}}
nim
=
nodeinfomanager
.
NewNodeInfoManager
(
host
.
GetNodeName
(),
host
)
...
...
@@ -597,23 +577,6 @@ func (p *csiPlugin) ConstructBlockVolumeSpec(podUID types.UID, specVolName, mapP
}
func
(
p
*
csiPlugin
)
skipAttach
(
driver
string
)
(
bool
,
error
)
{
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIDriverRegistry
)
{
return
false
,
nil
}
if
p
.
csiDriverLister
==
nil
{
return
false
,
errors
.
New
(
"CSIDriver lister does not exist"
)
}
csiDriver
,
err
:=
p
.
csiDriverLister
.
Get
(
driver
)
if
err
!=
nil
{
if
apierrs
.
IsNotFound
(
err
)
{
// Don't skip attach if CSIDriver does not exist
return
false
,
nil
}
return
false
,
err
}
if
csiDriver
.
Spec
.
AttachRequired
!=
nil
&&
*
csiDriver
.
Spec
.
AttachRequired
==
false
{
return
true
,
nil
}
return
false
,
nil
}
...
...
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/controller_policy.go
View file @
4e3bc8cc
...
...
@@ -73,9 +73,6 @@ func buildControllerRoles() ([]rbacv1.ClusterRole, []rbacv1.ClusterRoleBinding)
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIPersistentVolume
)
{
role
.
Rules
=
append
(
role
.
Rules
,
rbacv1helpers
.
NewRule
(
"get"
,
"create"
,
"delete"
,
"list"
,
"watch"
)
.
Groups
(
storageGroup
)
.
Resources
(
"volumeattachments"
)
.
RuleOrDie
())
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIDriverRegistry
)
{
role
.
Rules
=
append
(
role
.
Rules
,
rbacv1helpers
.
NewRule
(
"get"
,
"watch"
,
"list"
)
.
Groups
(
"csi.storage.k8s.io"
)
.
Resources
(
"csidrivers"
)
.
RuleOrDie
())
}
}
return
role
...
...
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go
View file @
4e3bc8cc
...
...
@@ -159,10 +159,6 @@ func NodeRules() []rbacv1.PolicyRule {
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIPersistentVolume
)
{
volAttachRule
:=
rbacv1helpers
.
NewRule
(
"get"
)
.
Groups
(
storageGroup
)
.
Resources
(
"volumeattachments"
)
.
RuleOrDie
()
nodePolicyRules
=
append
(
nodePolicyRules
,
volAttachRule
)
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIDriverRegistry
)
{
csiDriverRule
:=
rbacv1helpers
.
NewRule
(
"get"
,
"watch"
,
"list"
)
.
Groups
(
"csi.storage.k8s.io"
)
.
Resources
(
"csidrivers"
)
.
RuleOrDie
()
nodePolicyRules
=
append
(
nodePolicyRules
,
csiDriverRule
)
}
}
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
KubeletPluginsWatcher
)
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSINodeInfo
)
{
...
...
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