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
a7dd7f14
Commit
a7dd7f14
authored
Feb 02, 2018
by
zhangxiaoyu-zidif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete duplicate function for getting volume source
parent
b3115df4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
glusterfs.go
pkg/volume/glusterfs/glusterfs.go
+7
-13
No files found.
pkg/volume/glusterfs/glusterfs.go
View file @
a7dd7f14
...
...
@@ -143,7 +143,11 @@ func (plugin *glusterfsPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode
}
func
(
plugin
*
glusterfsPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
source
,
_
:=
plugin
.
getGlusterVolumeSource
(
spec
)
source
,
_
,
err
:=
getVolumeSource
(
spec
)
if
err
!=
nil
{
glog
.
Errorf
(
"failed to get gluster volumesource: %v"
,
err
)
return
nil
,
err
}
epName
:=
source
.
EndpointsName
// PVC/POD is in same ns.
podNs
:=
pod
.
Namespace
...
...
@@ -160,17 +164,8 @@ func (plugin *glusterfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volu
return
plugin
.
newMounterInternal
(
spec
,
ep
,
pod
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()))
}
func
(
plugin
*
glusterfsPlugin
)
getGlusterVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
GlusterfsVolumeSource
,
bool
)
{
// Glusterfs volumes used directly in a pod have a ReadOnly flag set by the pod author.
// Glusterfs volumes used as a PersistentVolume gets the ReadOnly flag indirectly through the persistent-claim volume used to mount the PV
if
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
Glusterfs
!=
nil
{
return
spec
.
Volume
.
Glusterfs
,
spec
.
Volume
.
Glusterfs
.
ReadOnly
}
return
spec
.
PersistentVolume
.
Spec
.
Glusterfs
,
spec
.
ReadOnly
}
func
(
plugin
*
glusterfsPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
ep
*
v1
.
Endpoints
,
pod
*
v1
.
Pod
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
source
,
readOnly
:=
plugin
.
getGluster
VolumeSource
(
spec
)
source
,
readOnly
,
_
:=
get
VolumeSource
(
spec
)
return
&
glusterfsMounter
{
glusterfs
:
&
glusterfs
{
volName
:
spec
.
Name
(),
...
...
@@ -379,8 +374,7 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
}
func
getVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
GlusterfsVolumeSource
,
bool
,
error
)
{
func
getVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
GlusterfsVolumeSource
,
bool
,
error
)
{
if
spec
.
Volume
!=
nil
&&
spec
.
Volume
.
Glusterfs
!=
nil
{
return
spec
.
Volume
.
Glusterfs
,
spec
.
Volume
.
Glusterfs
.
ReadOnly
,
nil
}
else
if
spec
.
PersistentVolume
!=
nil
&&
...
...
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