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
967405f0
Commit
967405f0
authored
Apr 15, 2015
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix locking issue in pod manager
parent
902e1196
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
pod_manager.go
pkg/kubelet/pod_manager.go
+11
-8
No files found.
pkg/kubelet/pod_manager.go
View file @
967405f0
...
...
@@ -249,22 +249,25 @@ func (self *basicPodManager) TranslatePodUID(uid types.UID) types.UID {
return
uid
}
func
(
self
*
basicPodManager
)
get
FullNameMaps
()
(
map
[
string
]
*
api
.
Pod
,
map
[
string
]
*
api
.
Pod
)
{
func
(
self
*
basicPodManager
)
get
OrphanedMirrorPodNames
()
[]
string
{
self
.
lock
.
RLock
()
defer
self
.
lock
.
RUnlock
()
return
self
.
podByFullName
,
self
.
mirrorPodByFullName
var
podFullNames
[]
string
for
podFullName
:=
range
self
.
mirrorPodByFullName
{
if
_
,
ok
:=
self
.
podByFullName
[
podFullName
];
!
ok
{
podFullNames
=
append
(
podFullNames
,
podFullName
)
}
}
return
podFullNames
}
// Delete all mirror pods which do not have associated static pods. This method
// sends deletion requets to the API server, but does NOT modify the internal
// pod storage in basicPodManager.
func
(
self
*
basicPodManager
)
DeleteOrphanedMirrorPods
()
{
podByFullName
,
mirrorPodByFullName
:=
self
.
getFullNameMaps
()
for
podFullName
:=
range
mirrorPodByFullName
{
if
_
,
ok
:=
podByFullName
[
podFullName
];
!
ok
{
self
.
mirrorClient
.
DeleteMirrorPod
(
podFullName
)
}
podFullNames
:=
self
.
getOrphanedMirrorPodNames
()
for
_
,
podFullName
:=
range
podFullNames
{
self
.
mirrorClient
.
DeleteMirrorPod
(
podFullName
)
}
}
...
...
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