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
0bbb49d2
Commit
0bbb49d2
authored
Jan 06, 2017
by
Kubernetes Submit Queue
Committed by
GitHub
Jan 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #39479 from fraenkel/podkiller
Automatic merge from submit-queue Avoid panic when stopping the podKiller use a mutex instead of a channel fixes #38857
parents
b79ae1c7
fb3a1d68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
18 deletions
+20
-18
kubelet_pods.go
pkg/kubelet/kubelet_pods.go
+20
-18
No files found.
pkg/kubelet/kubelet_pods.go
View file @
0bbb49d2
...
@@ -29,6 +29,7 @@ import (
...
@@ -29,6 +29,7 @@ import (
"runtime"
"runtime"
"sort"
"sort"
"strings"
"strings"
"sync"
"time"
"time"
"github.com/golang/glog"
"github.com/golang/glog"
...
@@ -799,8 +800,8 @@ func (kl *Kubelet) HandlePodCleanups() error {
...
@@ -799,8 +800,8 @@ func (kl *Kubelet) HandlePodCleanups() error {
// another goroutine isn't already in action.
// another goroutine isn't already in action.
func
(
kl
*
Kubelet
)
podKiller
()
{
func
(
kl
*
Kubelet
)
podKiller
()
{
killing
:=
sets
.
NewString
()
killing
:=
sets
.
NewString
()
resultCh
:=
make
(
chan
types
.
UID
)
// guard for the killing set
defer
close
(
resultCh
)
lock
:=
sync
.
Mutex
{}
for
{
for
{
select
{
select
{
case
podPair
,
ok
:=
<-
kl
.
podKillingCh
:
case
podPair
,
ok
:=
<-
kl
.
podKillingCh
:
...
@@ -811,24 +812,25 @@ func (kl *Kubelet) podKiller() {
...
@@ -811,24 +812,25 @@ func (kl *Kubelet) podKiller() {
runningPod
:=
podPair
.
RunningPod
runningPod
:=
podPair
.
RunningPod
apiPod
:=
podPair
.
APIPod
apiPod
:=
podPair
.
APIPod
if
killing
.
Has
(
string
(
runningPod
.
ID
))
{
lock
.
Lock
()
// The pod is already being killed.
exists
:=
killing
.
Has
(
string
(
runningPod
.
ID
))
break
if
!
exists
{
killing
.
Insert
(
string
(
runningPod
.
ID
))
}
}
killing
.
Insert
(
string
(
runningPod
.
ID
))
lock
.
Unlock
()
go
func
(
apiPod
*
v1
.
Pod
,
runningPod
*
kubecontainer
.
Pod
,
ch
chan
types
.
UID
)
{
defer
func
()
{
ch
<-
runningPod
.
ID
}()
glog
.
V
(
2
)
.
Infof
(
"Killing unwanted pod %q"
,
runningPod
.
Name
)
err
:=
kl
.
killPod
(
apiPod
,
runningPod
,
nil
,
nil
)
if
err
!=
nil
{
glog
.
Errorf
(
"Failed killing the pod %q: %v"
,
runningPod
.
Name
,
err
)
}
}(
apiPod
,
runningPod
,
resultCh
)
case
podID
:=
<-
resultCh
:
if
!
exists
{
killing
.
Delete
(
string
(
podID
))
go
func
(
apiPod
*
v1
.
Pod
,
runningPod
*
kubecontainer
.
Pod
)
{
glog
.
V
(
2
)
.
Infof
(
"Killing unwanted pod %q"
,
runningPod
.
Name
)
err
:=
kl
.
killPod
(
apiPod
,
runningPod
,
nil
,
nil
)
if
err
!=
nil
{
glog
.
Errorf
(
"Failed killing the pod %q: %v"
,
runningPod
.
Name
,
err
)
}
lock
.
Lock
()
killing
.
Delete
(
string
(
runningPod
.
ID
))
lock
.
Unlock
()
}(
apiPod
,
runningPod
)
}
}
}
}
}
}
}
...
...
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