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
b3c45247
Commit
b3c45247
authored
Apr 25, 2017
by
jayunit100
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup orphan logging that goes on in the sync loop.
parent
cd380b58
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
kubelet_volumes.go
pkg/kubelet/kubelet_volumes.go
+20
-6
No files found.
pkg/kubelet/kubelet_volumes.go
View file @
b3c45247
...
@@ -78,7 +78,7 @@ func (kl *Kubelet) newVolumeMounterFromPlugins(spec *volume.Spec, pod *v1.Pod, o
...
@@ -78,7 +78,7 @@ func (kl *Kubelet) newVolumeMounterFromPlugins(spec *volume.Spec, pod *v1.Pod, o
}
}
// cleanupOrphanedPodDirs removes the volumes of pods that should not be
// cleanupOrphanedPodDirs removes the volumes of pods that should not be
// running and that have no containers running.
// running and that have no containers running.
Note that we roll up logs here since it runs in the main loop.
func
(
kl
*
Kubelet
)
cleanupOrphanedPodDirs
(
func
(
kl
*
Kubelet
)
cleanupOrphanedPodDirs
(
pods
[]
*
v1
.
Pod
,
runningPods
[]
*
kubecontainer
.
Pod
)
error
{
pods
[]
*
v1
.
Pod
,
runningPods
[]
*
kubecontainer
.
Pod
)
error
{
allPods
:=
sets
.
NewString
()
allPods
:=
sets
.
NewString
()
...
@@ -93,7 +93,10 @@ func (kl *Kubelet) cleanupOrphanedPodDirs(
...
@@ -93,7 +93,10 @@ func (kl *Kubelet) cleanupOrphanedPodDirs(
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
errlist
:=
[]
error
{}
orphanRemovalErrors
:=
[]
error
{}
orphanVolumeErrors
:=
[]
error
{}
for
_
,
uid
:=
range
found
{
for
_
,
uid
:=
range
found
{
if
allPods
.
Has
(
string
(
uid
))
{
if
allPods
.
Has
(
string
(
uid
))
{
continue
continue
...
@@ -107,18 +110,29 @@ func (kl *Kubelet) cleanupOrphanedPodDirs(
...
@@ -107,18 +110,29 @@ func (kl *Kubelet) cleanupOrphanedPodDirs(
// If there are still volume directories, do not delete directory
// If there are still volume directories, do not delete directory
volumePaths
,
err
:=
kl
.
getPodVolumePathListFromDisk
(
uid
)
volumePaths
,
err
:=
kl
.
getPodVolumePathListFromDisk
(
uid
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Orphaned pod %q found, but error %v occurred during reading volume dir from disk"
,
uid
,
err
)
orphanVolumeErrors
=
append
(
orphanVolumeErrors
,
fmt
.
Errorf
(
"Orphaned pod %q found, but error %v occurred during reading volume dir from disk"
,
uid
,
err
)
)
continue
continue
}
}
if
len
(
volumePaths
)
>
0
{
if
len
(
volumePaths
)
>
0
{
glog
.
Errorf
(
"Orphaned pod %q found, but volume paths are still present on disk."
,
uid
)
orphanVolumeErrors
=
append
(
orphanVolumeErrors
,
fmt
.
Errorf
(
"Orphaned pod %q found, but volume paths are still present on disk."
,
uid
)
)
continue
continue
}
}
glog
.
V
(
3
)
.
Infof
(
"Orphaned pod %q found, removing"
,
uid
)
glog
.
V
(
3
)
.
Infof
(
"Orphaned pod %q found, removing"
,
uid
)
if
err
:=
removeall
.
RemoveAllOneFilesystem
(
kl
.
mounter
,
kl
.
getPodDir
(
uid
));
err
!=
nil
{
if
err
:=
removeall
.
RemoveAllOneFilesystem
(
kl
.
mounter
,
kl
.
getPodDir
(
uid
));
err
!=
nil
{
glog
.
Errorf
(
"Failed to remove orphaned pod %q dir; err: %v"
,
uid
,
err
)
glog
.
Errorf
(
"Failed to remove orphaned pod %q dir; err: %v"
,
uid
,
err
)
errlist
=
append
(
errlist
,
err
)
orphanRemovalErrors
=
append
(
orphanRemovalErrors
,
err
)
}
}
logSpew
:=
func
(
errs
[]
error
)
{
if
len
(
errs
)
>
0
{
glog
.
Errorf
(
"%v : There were a total of %v errors similar to this. Turn up verbosity to see them."
,
errs
[
0
],
len
(
errs
))
for
_
,
err
:=
range
errs
{
glog
.
V
(
5
)
.
Infof
(
"Orphan pod: %v"
,
err
)
}
}
}
}
}
return
utilerrors
.
NewAggregate
(
errlist
)
logSpew
(
orphanVolumeErrors
)
logSpew
(
orphanRemovalErrors
)
return
utilerrors
.
NewAggregate
(
orphanRemovalErrors
)
}
}
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