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
da3683e2
Commit
da3683e2
authored
Oct 17, 2016
by
Seth Jennings
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubelet: storage: don't hang kubelet on unresponsive nfs
parent
714f816a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
43 deletions
+18
-43
kubelet_getters.go
pkg/kubelet/kubelet_getters.go
+3
-10
reconciler.go
pkg/kubelet/volumemanager/reconciler/reconciler.go
+10
-12
util.go
pkg/util/util.go
+5
-21
No files found.
pkg/kubelet/kubelet_getters.go
View file @
da3683e2
...
...
@@ -252,18 +252,11 @@ func (kl *Kubelet) getPodVolumeNameListFromDisk(podUID types.UID) ([]string, err
for
_
,
volumePluginDir
:=
range
volumePluginDirs
{
volumePluginName
:=
volumePluginDir
.
Name
()
volumePluginPath
:=
path
.
Join
(
podVolDir
,
volumePluginName
)
volumeDirs
,
volumeDirsStatErrs
,
err
:=
util
.
ReadDirNoExi
t
(
volumePluginPath
)
volumeDirs
,
err
:=
util
.
ReadDirNoSta
t
(
volumePluginPath
)
if
err
!=
nil
{
return
volumes
,
fmt
.
Errorf
(
"Could not read directory %s: %v"
,
volumePluginPath
,
err
)
}
for
i
,
volumeDir
:=
range
volumeDirs
{
if
volumeDir
!=
nil
{
volumes
=
append
(
volumes
,
volumeDir
.
Name
())
continue
}
glog
.
Errorf
(
"Could not read directory %s: %v"
,
podVolDir
,
volumeDirsStatErrs
[
i
])
return
volumes
,
err
}
volumes
=
append
(
volumes
,
volumeDirs
...
)
}
return
volumes
,
nil
}
pkg/kubelet/volumemanager/reconciler/reconciler.go
View file @
da3683e2
...
...
@@ -32,6 +32,7 @@ import (
"k8s.io/kubernetes/pkg/kubelet/config"
"k8s.io/kubernetes/pkg/kubelet/volumemanager/cache"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/goroutinemap/exponentialbackoff"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/util/strings"
...
...
@@ -531,24 +532,21 @@ func getVolumesFromPodDir(podDir string) ([]podVolume, error) {
pluginName
:=
volumeDir
.
Name
()
volumePluginPath
:=
path
.
Join
(
volumesDir
,
pluginName
)
volumePluginDirs
,
err
:=
ioutil
.
ReadDir
(
volumePluginPath
)
volumePluginDirs
,
err
:=
util
.
ReadDirNoStat
(
volumePluginPath
)
if
err
!=
nil
{
glog
.
Errorf
(
"Could not read volume plugin directory %q: %v"
,
volumePluginPath
,
err
)
continue
}
unescapePluginName
:=
strings
.
UnescapeQualifiedNameForDisk
(
pluginName
)
for
_
,
volumeNameDir
:=
range
volumePluginDirs
{
if
volumeNameDir
!=
nil
{
volumeName
:=
volumeNameDir
.
Name
()
mountPath
:=
path
.
Join
(
volumePluginPath
,
volumeName
)
volumes
=
append
(
volumes
,
podVolume
{
podName
:
volumetypes
.
UniquePodName
(
podName
),
volumeSpecName
:
volumeName
,
mountPath
:
mountPath
,
pluginName
:
unescapePluginName
,
})
}
for
_
,
volumeName
:=
range
volumePluginDirs
{
mountPath
:=
path
.
Join
(
volumePluginPath
,
volumeName
)
volumes
=
append
(
volumes
,
podVolume
{
podName
:
volumetypes
.
UniquePodName
(
podName
),
volumeSpecName
:
volumeName
,
mountPath
:
mountPath
,
pluginName
:
unescapePluginName
,
})
}
}
...
...
pkg/util/util.go
View file @
da3683e2
...
...
@@ -84,36 +84,20 @@ func FileExists(filename string) (bool, error) {
return
true
,
nil
}
// borrowed from ioutil.ReadDir
// ReadDir reads the directory named by dirname and returns
// a list of directory entries, minus those with lstat errors
func
ReadDirNoExit
(
dirname
string
)
([]
os
.
FileInfo
,
[]
error
,
error
)
{
// ReadDirNoStat returns a string of files/directories contained
// in dirname without calling lstat on them.
func
ReadDirNoStat
(
dirname
string
)
([]
string
,
error
)
{
if
dirname
==
""
{
dirname
=
"."
}
f
,
err
:=
os
.
Open
(
dirname
)
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
defer
f
.
Close
()
names
,
err
:=
f
.
Readdirnames
(
-
1
)
list
:=
make
([]
os
.
FileInfo
,
0
,
len
(
names
))
errs
:=
make
([]
error
,
0
,
len
(
names
))
for
_
,
filename
:=
range
names
{
fip
,
lerr
:=
os
.
Lstat
(
dirname
+
"/"
+
filename
)
if
os
.
IsNotExist
(
lerr
)
{
// File disappeared between readdir + stat.
// Just treat it as if it didn't exist.
continue
}
list
=
append
(
list
,
fip
)
errs
=
append
(
errs
,
lerr
)
}
return
list
,
errs
,
nil
return
f
.
Readdirnames
(
-
1
)
}
// IntPtr returns a pointer to an int
...
...
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