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
bc93e7bc
Commit
bc93e7bc
authored
May 27, 2017
by
Di Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove redundant carriage return for readable
parent
b58c7ec4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
16 deletions
+6
-16
volume_manager.go
pkg/kubelet/volumemanager/volume_manager.go
+4
-8
volume_manager_test.go
pkg/kubelet/volumemanager/volume_manager_test.go
+2
-8
No files found.
pkg/kubelet/volumemanager/volume_manager.go
View file @
bc93e7bc
...
@@ -249,8 +249,7 @@ func (vm *volumeManager) Run(sourcesReady config.SourcesReady, stopCh <-chan str
...
@@ -249,8 +249,7 @@ func (vm *volumeManager) Run(sourcesReady config.SourcesReady, stopCh <-chan str
glog
.
Infof
(
"Shutting down Kubelet Volume Manager"
)
glog
.
Infof
(
"Shutting down Kubelet Volume Manager"
)
}
}
func
(
vm
*
volumeManager
)
GetMountedVolumesForPod
(
func
(
vm
*
volumeManager
)
GetMountedVolumesForPod
(
podName
types
.
UniquePodName
)
container
.
VolumeMap
{
podName
types
.
UniquePodName
)
container
.
VolumeMap
{
podVolumes
:=
make
(
container
.
VolumeMap
)
podVolumes
:=
make
(
container
.
VolumeMap
)
for
_
,
mountedVolume
:=
range
vm
.
actualStateOfWorld
.
GetMountedVolumesForPod
(
podName
)
{
for
_
,
mountedVolume
:=
range
vm
.
actualStateOfWorld
.
GetMountedVolumesForPod
(
podName
)
{
podVolumes
[
mountedVolume
.
OuterVolumeSpecName
]
=
container
.
VolumeInfo
{
Mounter
:
mountedVolume
.
Mounter
}
podVolumes
[
mountedVolume
.
OuterVolumeSpecName
]
=
container
.
VolumeInfo
{
Mounter
:
mountedVolume
.
Mounter
}
...
@@ -373,8 +372,7 @@ func (vm *volumeManager) WaitForAttachAndMount(pod *v1.Pod) error {
...
@@ -373,8 +372,7 @@ func (vm *volumeManager) WaitForAttachAndMount(pod *v1.Pod) error {
// verifyVolumesMountedFunc returns a method that returns true when all expected
// verifyVolumesMountedFunc returns a method that returns true when all expected
// volumes are mounted.
// volumes are mounted.
func
(
vm
*
volumeManager
)
verifyVolumesMountedFunc
(
func
(
vm
*
volumeManager
)
verifyVolumesMountedFunc
(
podName
types
.
UniquePodName
,
expectedVolumes
[]
string
)
wait
.
ConditionFunc
{
podName
types
.
UniquePodName
,
expectedVolumes
[]
string
)
wait
.
ConditionFunc
{
return
func
()
(
done
bool
,
err
error
)
{
return
func
()
(
done
bool
,
err
error
)
{
return
len
(
vm
.
getUnmountedVolumes
(
podName
,
expectedVolumes
))
==
0
,
nil
return
len
(
vm
.
getUnmountedVolumes
(
podName
,
expectedVolumes
))
==
0
,
nil
}
}
...
@@ -383,8 +381,7 @@ func (vm *volumeManager) verifyVolumesMountedFunc(
...
@@ -383,8 +381,7 @@ func (vm *volumeManager) verifyVolumesMountedFunc(
// getUnmountedVolumes fetches the current list of mounted volumes from
// getUnmountedVolumes fetches the current list of mounted volumes from
// the actual state of the world, and uses it to process the list of
// the actual state of the world, and uses it to process the list of
// expectedVolumes. It returns a list of unmounted volumes.
// expectedVolumes. It returns a list of unmounted volumes.
func
(
vm
*
volumeManager
)
getUnmountedVolumes
(
func
(
vm
*
volumeManager
)
getUnmountedVolumes
(
podName
types
.
UniquePodName
,
expectedVolumes
[]
string
)
[]
string
{
podName
types
.
UniquePodName
,
expectedVolumes
[]
string
)
[]
string
{
mountedVolumes
:=
sets
.
NewString
()
mountedVolumes
:=
sets
.
NewString
()
for
_
,
mountedVolume
:=
range
vm
.
actualStateOfWorld
.
GetMountedVolumesForPod
(
podName
)
{
for
_
,
mountedVolume
:=
range
vm
.
actualStateOfWorld
.
GetMountedVolumesForPod
(
podName
)
{
mountedVolumes
.
Insert
(
mountedVolume
.
OuterVolumeSpecName
)
mountedVolumes
.
Insert
(
mountedVolume
.
OuterVolumeSpecName
)
...
@@ -394,8 +391,7 @@ func (vm *volumeManager) getUnmountedVolumes(
...
@@ -394,8 +391,7 @@ func (vm *volumeManager) getUnmountedVolumes(
// filterUnmountedVolumes adds each element of expectedVolumes that is not in
// filterUnmountedVolumes adds each element of expectedVolumes that is not in
// mountedVolumes to a list of unmountedVolumes and returns it.
// mountedVolumes to a list of unmountedVolumes and returns it.
func
filterUnmountedVolumes
(
func
filterUnmountedVolumes
(
mountedVolumes
sets
.
String
,
expectedVolumes
[]
string
)
[]
string
{
mountedVolumes
sets
.
String
,
expectedVolumes
[]
string
)
[]
string
{
unmountedVolumes
:=
[]
string
{}
unmountedVolumes
:=
[]
string
{}
for
_
,
expectedVolume
:=
range
expectedVolumes
{
for
_
,
expectedVolume
:=
range
expectedVolumes
{
if
!
mountedVolumes
.
Has
(
expectedVolume
)
{
if
!
mountedVolumes
.
Has
(
expectedVolume
)
{
...
...
pkg/kubelet/volumemanager/volume_manager_test.go
View file @
bc93e7bc
...
@@ -182,10 +182,7 @@ func TestGetExtraSupplementalGroupsForPod(t *testing.T) {
...
@@ -182,10 +182,7 @@ func TestGetExtraSupplementalGroupsForPod(t *testing.T) {
}
}
}
}
func
newTestVolumeManager
(
func
newTestVolumeManager
(
tmpDir
string
,
podManager
pod
.
Manager
,
kubeClient
clientset
.
Interface
)
(
VolumeManager
,
error
)
{
tmpDir
string
,
podManager
pod
.
Manager
,
kubeClient
clientset
.
Interface
)
(
VolumeManager
,
error
)
{
plug
:=
&
volumetest
.
FakeVolumePlugin
{
PluginName
:
"fake"
,
Host
:
nil
}
plug
:=
&
volumetest
.
FakeVolumePlugin
{
PluginName
:
"fake"
,
Host
:
nil
}
fakeRecorder
:=
&
record
.
FakeRecorder
{}
fakeRecorder
:=
&
record
.
FakeRecorder
{}
plugMgr
:=
&
volume
.
VolumePluginMgr
{}
plugMgr
:=
&
volume
.
VolumePluginMgr
{}
...
@@ -275,10 +272,7 @@ func createObjects() (*v1.Node, *v1.Pod, *v1.PersistentVolume, *v1.PersistentVol
...
@@ -275,10 +272,7 @@ func createObjects() (*v1.Node, *v1.Pod, *v1.PersistentVolume, *v1.PersistentVol
return
node
,
pod
,
pv
,
claim
return
node
,
pod
,
pv
,
claim
}
}
func
simulateVolumeInUseUpdate
(
func
simulateVolumeInUseUpdate
(
volumeName
v1
.
UniqueVolumeName
,
stopCh
<-
chan
struct
{},
volumeManager
VolumeManager
)
{
volumeName
v1
.
UniqueVolumeName
,
stopCh
<-
chan
struct
{},
volumeManager
VolumeManager
)
{
ticker
:=
time
.
NewTicker
(
100
*
time
.
Millisecond
)
ticker
:=
time
.
NewTicker
(
100
*
time
.
Millisecond
)
defer
ticker
.
Stop
()
defer
ticker
.
Stop
()
for
{
for
{
...
...
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