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
450a71cd
Commit
450a71cd
authored
Jul 18, 2016
by
k8s-merge-robot
Committed by
GitHub
Jul 18, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #29093 from wojtek-t/fix_scheduler_crash
Automatic merge from submit-queue Fix crashes in schedulercache Fix #29090 @davidopp
parents
5f766748
78101ac5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
cache.go
plugin/pkg/scheduler/schedulercache/cache.go
+1
-0
cache_test.go
plugin/pkg/scheduler/schedulercache/cache_test.go
+30
-0
No files found.
plugin/pkg/scheduler/schedulercache/cache.go
View file @
450a71cd
...
...
@@ -149,6 +149,7 @@ func (cache *schedulerCache) ForgetPod(pod *api.Pod) error {
if
err
!=
nil
{
return
err
}
delete
(
cache
.
assumedPods
,
key
)
delete
(
cache
.
podStates
,
key
)
default
:
return
fmt
.
Errorf
(
"pod state wasn't assumed but get forgotten. Pod key: %v"
,
key
)
...
...
plugin/pkg/scheduler/schedulercache/cache_test.go
View file @
450a71cd
...
...
@@ -457,6 +457,36 @@ func TestRemovePod(t *testing.T) {
}
}
func
TestForgetPod
(
t
*
testing
.
T
)
{
nodeName
:=
"node"
basePod
:=
makeBasePod
(
nodeName
,
"test"
,
"100m"
,
"500"
,
[]
api
.
ContainerPort
{{
HostPort
:
80
}})
tests
:=
[]
struct
{
pods
[]
*
api
.
Pod
}{{
pods
:
[]
*
api
.
Pod
{
basePod
},
}}
now
:=
time
.
Now
()
ttl
:=
10
*
time
.
Second
for
i
,
tt
:=
range
tests
{
cache
:=
newSchedulerCache
(
ttl
,
time
.
Second
,
nil
)
for
_
,
pod
:=
range
tt
.
pods
{
if
err
:=
cache
.
assumePod
(
pod
,
now
);
err
!=
nil
{
t
.
Fatalf
(
"assumePod failed: %v"
,
err
)
}
}
for
_
,
pod
:=
range
tt
.
pods
{
if
err
:=
cache
.
ForgetPod
(
pod
);
err
!=
nil
{
t
.
Fatalf
(
"ForgetPod failed: %v"
,
err
)
}
}
cache
.
cleanupAssumedPods
(
now
.
Add
(
2
*
ttl
))
if
n
:=
cache
.
nodes
[
nodeName
];
n
!=
nil
{
t
.
Errorf
(
"#%d: expecting pod deleted and nil node info, get=%s"
,
i
,
n
)
}
}
}
func
BenchmarkList1kNodes30kPods
(
b
*
testing
.
B
)
{
cache
:=
setupCacheOf1kNodes30kPods
(
b
)
b
.
ResetTimer
()
...
...
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