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
e3320514
Unverified
Commit
e3320514
authored
May 07, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
May 07, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #77433 from cwdsuzhou/common_func_for_ad
Add common func for NewAttacher and NewDetacher
parents
2e6f58dd
62fe5fe7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
22 deletions
+16
-22
csi_plugin.go
pkg/volume/csi/csi_plugin.go
+16
-22
No files found.
pkg/volume/csi/csi_plugin.go
View file @
e3320514
...
@@ -550,17 +550,7 @@ var _ volume.AttachableVolumePlugin = &csiPlugin{}
...
@@ -550,17 +550,7 @@ var _ volume.AttachableVolumePlugin = &csiPlugin{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
csiPlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
csiPlugin
{}
func
(
p
*
csiPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
func
(
p
*
csiPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
k8s
:=
p
.
host
.
GetKubeClient
()
return
p
.
newAttacherDetacher
()
if
k8s
==
nil
{
klog
.
Error
(
log
(
"unable to get kubernetes client from host"
))
return
nil
,
errors
.
New
(
"unable to get Kubernetes client"
)
}
return
&
csiAttacher
{
plugin
:
p
,
k8s
:
k8s
,
waitSleepTime
:
1
*
time
.
Second
,
},
nil
}
}
func
(
p
*
csiPlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
func
(
p
*
csiPlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
...
@@ -568,17 +558,7 @@ func (p *csiPlugin) NewDeviceMounter() (volume.DeviceMounter, error) {
...
@@ -568,17 +558,7 @@ func (p *csiPlugin) NewDeviceMounter() (volume.DeviceMounter, error) {
}
}
func
(
p
*
csiPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
p
*
csiPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
k8s
:=
p
.
host
.
GetKubeClient
()
return
p
.
newAttacherDetacher
()
if
k8s
==
nil
{
klog
.
Error
(
log
(
"unable to get kubernetes client from host"
))
return
nil
,
errors
.
New
(
"unable to get Kubernetes client"
)
}
return
&
csiAttacher
{
plugin
:
p
,
k8s
:
k8s
,
waitSleepTime
:
1
*
time
.
Second
,
},
nil
}
}
func
(
p
*
csiPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
p
*
csiPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
@@ -837,6 +817,20 @@ func (p *csiPlugin) getPublishContext(client clientset.Interface, handle, driver
...
@@ -837,6 +817,20 @@ func (p *csiPlugin) getPublishContext(client clientset.Interface, handle, driver
return
attachment
.
Status
.
AttachmentMetadata
,
nil
return
attachment
.
Status
.
AttachmentMetadata
,
nil
}
}
func
(
p
*
csiPlugin
)
newAttacherDetacher
()
(
*
csiAttacher
,
error
)
{
k8s
:=
p
.
host
.
GetKubeClient
()
if
k8s
==
nil
{
klog
.
Error
(
log
(
"unable to get kubernetes client from host"
))
return
nil
,
errors
.
New
(
"unable to get Kubernetes client"
)
}
return
&
csiAttacher
{
plugin
:
p
,
k8s
:
k8s
,
waitSleepTime
:
1
*
time
.
Second
,
},
nil
}
func
unregisterDriver
(
driverName
string
)
error
{
func
unregisterDriver
(
driverName
string
)
error
{
csiDrivers
.
Delete
(
driverName
)
csiDrivers
.
Delete
(
driverName
)
...
...
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