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
e6e69e31
Commit
e6e69e31
authored
Sep 04, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13363 from mesosphere/abort-kubelet-syncloop
Auto commit by PR queue bot
parents
24430525
de064f42
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
kubelet.go
pkg/kubelet/kubelet.go
+8
-5
kubelet_test.go
pkg/kubelet/kubelet_test.go
+20
-0
No files found.
pkg/kubelet/kubelet.go
View file @
e6e69e31
...
...
@@ -1896,17 +1896,19 @@ func (kl *Kubelet) syncLoop(updates <-chan PodUpdate, handler SyncHandler) {
}
housekeepingTimestamp
=
time
.
Now
()
}
kl
.
syncLoopIteration
(
updates
,
handler
)
if
!
kl
.
syncLoopIteration
(
updates
,
handler
)
{
break
}
}
}
func
(
kl
*
Kubelet
)
syncLoopIteration
(
updates
<-
chan
PodUpdate
,
handler
SyncHandler
)
{
func
(
kl
*
Kubelet
)
syncLoopIteration
(
updates
<-
chan
PodUpdate
,
handler
SyncHandler
)
bool
{
kl
.
syncLoopMonitor
.
Store
(
time
.
Now
())
select
{
case
u
,
o
k
:=
<-
updates
:
if
!
o
k
{
case
u
,
o
pen
:=
<-
updates
:
if
!
o
pen
{
glog
.
Errorf
(
"Update channel is closed. Exiting the sync loop."
)
return
return
false
}
switch
u
.
Op
{
case
ADD
:
...
...
@@ -1928,6 +1930,7 @@ func (kl *Kubelet) syncLoopIteration(updates <-chan PodUpdate, handler SyncHandl
handler
.
HandlePodSyncs
(
kl
.
podManager
.
GetPods
())
}
kl
.
syncLoopMonitor
.
Store
(
time
.
Now
())
return
true
}
func
(
kl
*
Kubelet
)
dispatchWork
(
pod
*
api
.
Pod
,
syncType
SyncPodType
,
mirrorPod
*
api
.
Pod
,
start
time
.
Time
)
{
...
...
pkg/kubelet/kubelet_test.go
View file @
e6e69e31
...
...
@@ -329,6 +329,26 @@ func TestSyncLoopTimeUpdate(t *testing.T) {
}
}
func
TestSyncLoopAbort
(
t
*
testing
.
T
)
{
testKubelet
:=
newTestKubelet
(
t
)
testKubelet
.
fakeCadvisor
.
On
(
"MachineInfo"
)
.
Return
(
&
cadvisorApi
.
MachineInfo
{},
nil
)
kubelet
:=
testKubelet
.
kubelet
kubelet
.
lastTimestampRuntimeUp
=
time
.
Now
()
kubelet
.
networkConfigured
=
true
ch
:=
make
(
chan
PodUpdate
)
close
(
ch
)
// sanity check (also prevent this test from hanging in the next step)
ok
:=
kubelet
.
syncLoopIteration
(
ch
,
kubelet
)
if
ok
{
t
.
Fatalf
(
"expected syncLoopIteration to return !ok since update chan was closed"
)
}
// this should terminate immediately; if it hangs then the syncLoopIteration isn't aborting properly
kubelet
.
syncLoop
(
ch
,
kubelet
)
}
func
TestSyncPodsStartPod
(
t
*
testing
.
T
)
{
testKubelet
:=
newTestKubelet
(
t
)
testKubelet
.
fakeCadvisor
.
On
(
"MachineInfo"
)
.
Return
(
&
cadvisorApi
.
MachineInfo
{},
nil
)
...
...
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