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
51b33e8a
Commit
51b33e8a
authored
Aug 22, 2017
by
Jan Safranek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gluster: Remove unused exe interface
parent
07dea6b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
28 deletions
+4
-28
glusterfs.go
pkg/volume/glusterfs/glusterfs.go
+3
-11
glusterfs_test.go
pkg/volume/glusterfs/glusterfs_test.go
+1
-17
No files found.
pkg/volume/glusterfs/glusterfs.go
View file @
51b33e8a
...
@@ -48,12 +48,11 @@ import (
...
@@ -48,12 +48,11 @@ import (
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
func
ProbeVolumePlugins
()
[]
volume
.
VolumePlugin
{
func
ProbeVolumePlugins
()
[]
volume
.
VolumePlugin
{
return
[]
volume
.
VolumePlugin
{
&
glusterfsPlugin
{
host
:
nil
,
exe
:
exec
.
New
(),
gidTable
:
make
(
map
[
string
]
*
MinMaxAllocator
)}}
return
[]
volume
.
VolumePlugin
{
&
glusterfsPlugin
{
host
:
nil
,
gidTable
:
make
(
map
[
string
]
*
MinMaxAllocator
)}}
}
}
type
glusterfsPlugin
struct
{
type
glusterfsPlugin
struct
{
host
volume
.
VolumeHost
host
volume
.
VolumeHost
exe
exec
.
Interface
gidTable
map
[
string
]
*
MinMaxAllocator
gidTable
map
[
string
]
*
MinMaxAllocator
gidTableLock
sync
.
Mutex
gidTableLock
sync
.
Mutex
}
}
...
@@ -152,7 +151,7 @@ func (plugin *glusterfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volu
...
@@ -152,7 +151,7 @@ func (plugin *glusterfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volu
return
nil
,
err
return
nil
,
err
}
}
glog
.
V
(
1
)
.
Infof
(
"glusterfs: endpoints %v"
,
ep
)
glog
.
V
(
1
)
.
Infof
(
"glusterfs: endpoints %v"
,
ep
)
return
plugin
.
newMounterInternal
(
spec
,
ep
,
pod
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
())
,
exec
.
New
()
)
return
plugin
.
newMounterInternal
(
spec
,
ep
,
pod
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()))
}
}
func
(
plugin
*
glusterfsPlugin
)
getGlusterVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
GlusterfsVolumeSource
,
bool
)
{
func
(
plugin
*
glusterfsPlugin
)
getGlusterVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
GlusterfsVolumeSource
,
bool
)
{
...
@@ -164,7 +163,7 @@ func (plugin *glusterfsPlugin) getGlusterVolumeSource(spec *volume.Spec) (*v1.Gl
...
@@ -164,7 +163,7 @@ func (plugin *glusterfsPlugin) getGlusterVolumeSource(spec *volume.Spec) (*v1.Gl
return
spec
.
PersistentVolume
.
Spec
.
Glusterfs
,
spec
.
ReadOnly
return
spec
.
PersistentVolume
.
Spec
.
Glusterfs
,
spec
.
ReadOnly
}
}
func
(
plugin
*
glusterfsPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
ep
*
v1
.
Endpoints
,
pod
*
v1
.
Pod
,
mounter
mount
.
Interface
,
exe
exec
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
glusterfsPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
ep
*
v1
.
Endpoints
,
pod
*
v1
.
Pod
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
source
,
readOnly
:=
plugin
.
getGlusterVolumeSource
(
spec
)
source
,
readOnly
:=
plugin
.
getGlusterVolumeSource
(
spec
)
return
&
glusterfsMounter
{
return
&
glusterfsMounter
{
glusterfs
:
&
glusterfs
{
glusterfs
:
&
glusterfs
{
...
@@ -176,7 +175,6 @@ func (plugin *glusterfsPlugin) newMounterInternal(spec *volume.Spec, ep *v1.Endp
...
@@ -176,7 +175,6 @@ func (plugin *glusterfsPlugin) newMounterInternal(spec *volume.Spec, ep *v1.Endp
hosts
:
ep
,
hosts
:
ep
,
path
:
source
.
Path
,
path
:
source
.
Path
,
readOnly
:
readOnly
,
readOnly
:
readOnly
,
exe
:
exe
,
mountOptions
:
volume
.
MountOptionFromSpec
(
spec
),
mountOptions
:
volume
.
MountOptionFromSpec
(
spec
),
},
nil
},
nil
}
}
...
@@ -194,11 +192,6 @@ func (plugin *glusterfsPlugin) newUnmounterInternal(volName string, podUID types
...
@@ -194,11 +192,6 @@ func (plugin *glusterfsPlugin) newUnmounterInternal(volName string, podUID types
}},
nil
}},
nil
}
}
func
(
plugin
*
glusterfsPlugin
)
execCommand
(
command
string
,
args
[]
string
)
([]
byte
,
error
)
{
cmd
:=
plugin
.
exe
.
Command
(
command
,
args
...
)
return
cmd
.
CombinedOutput
()
}
func
(
plugin
*
glusterfsPlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
func
(
plugin
*
glusterfsPlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
glusterfsVolume
:=
&
v1
.
Volume
{
glusterfsVolume
:=
&
v1
.
Volume
{
Name
:
volumeName
,
Name
:
volumeName
,
...
@@ -226,7 +219,6 @@ type glusterfsMounter struct {
...
@@ -226,7 +219,6 @@ type glusterfsMounter struct {
hosts
*
v1
.
Endpoints
hosts
*
v1
.
Endpoints
path
string
path
string
readOnly
bool
readOnly
bool
exe
exec
.
Interface
mountOptions
[]
string
mountOptions
[]
string
}
}
...
...
pkg/volume/glusterfs/glusterfs_test.go
View file @
51b33e8a
...
@@ -33,8 +33,6 @@ import (
...
@@ -33,8 +33,6 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
"k8s.io/utils/exec"
fakeexec
"k8s.io/utils/exec/testing"
)
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
@@ -104,22 +102,8 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
...
@@ -104,22 +102,8 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
}
}
ep
:=
&
v1
.
Endpoints
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
},
Subsets
:
[]
v1
.
EndpointSubset
{{
ep
:=
&
v1
.
Endpoints
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
},
Subsets
:
[]
v1
.
EndpointSubset
{{
Addresses
:
[]
v1
.
EndpointAddress
{{
IP
:
"127.0.0.1"
}}}}}
Addresses
:
[]
v1
.
EndpointAddress
{{
IP
:
"127.0.0.1"
}}}}}
var
fcmd
fakeexec
.
FakeCmd
fcmd
=
fakeexec
.
FakeCmd
{
CombinedOutputScript
:
[]
fakeexec
.
FakeCombinedOutputAction
{
// mount
func
()
([]
byte
,
error
)
{
return
[]
byte
{},
nil
},
},
}
fake
:=
fakeexec
.
FakeExec
{
CommandScript
:
[]
fakeexec
.
FakeCommandAction
{
func
(
cmd
string
,
args
...
string
)
exec
.
Cmd
{
return
fakeexec
.
InitFakeCmd
(
&
fcmd
,
cmd
,
args
...
)
},
},
}
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
mounter
,
err
:=
plug
.
(
*
glusterfsPlugin
)
.
newMounterInternal
(
spec
,
ep
,
pod
,
&
mount
.
FakeMounter
{}
,
&
fake
)
mounter
,
err
:=
plug
.
(
*
glusterfsPlugin
)
.
newMounterInternal
(
spec
,
ep
,
pod
,
&
mount
.
FakeMounter
{})
volumePath
:=
mounter
.
GetPath
()
volumePath
:=
mounter
.
GetPath
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
...
...
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