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
dcef90f4
Commit
dcef90f4
authored
Oct 13, 2014
by
Brendan Burns
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1752 from ddysher/scheduler-race
Use DesiredState.Host in scheduler predicate
parents
6820e068
19c62d71
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
predicates.go
pkg/scheduler/predicates.go
+1
-1
priorities_test.go
pkg/scheduler/priorities_test.go
+10
-8
No files found.
pkg/scheduler/predicates.go
View file @
dcef90f4
...
...
@@ -143,7 +143,7 @@ func MapPodsToMachines(lister PodLister) (map[string][]api.Pod, error) {
return
map
[
string
][]
api
.
Pod
{},
err
}
for
_
,
scheduledPod
:=
range
pods
{
host
:=
scheduledPod
.
Current
State
.
Host
host
:=
scheduledPod
.
Desired
State
.
Host
machineToPods
[
host
]
=
append
(
machineToPods
[
host
],
scheduledPod
)
}
return
machineToPods
,
nil
...
...
pkg/scheduler/priorities_test.go
View file @
dcef90f4
...
...
@@ -59,6 +59,7 @@ func TestLeastRequested(t *testing.T) {
{
CPU
:
2000
},
},
},
Host
:
"machine1"
,
}
cpuAndMemory
:=
api
.
PodState
{
Manifest
:
api
.
ContainerManifest
{
...
...
@@ -67,6 +68,7 @@ func TestLeastRequested(t *testing.T) {
{
CPU
:
2000
,
Memory
:
3000
},
},
},
Host
:
"machine2"
,
}
tests
:=
[]
struct
{
pod
api
.
Pod
...
...
@@ -85,10 +87,10 @@ func TestLeastRequested(t *testing.T) {
expectedList
:
[]
HostPriority
{{
"machine1"
,
0
},
{
"machine2"
,
0
}},
test
:
"no resources requested"
,
pods
:
[]
api
.
Pod
{
{
Current
State
:
machine1State
,
Labels
:
labels2
},
{
Current
State
:
machine1State
,
Labels
:
labels1
},
{
Current
State
:
machine2State
,
Labels
:
labels1
},
{
Current
State
:
machine2State
,
Labels
:
labels1
},
{
Desired
State
:
machine1State
,
Labels
:
labels2
},
{
Desired
State
:
machine1State
,
Labels
:
labels1
},
{
Desired
State
:
machine2State
,
Labels
:
labels1
},
{
Desired
State
:
machine2State
,
Labels
:
labels1
},
},
},
{
...
...
@@ -96,8 +98,8 @@ func TestLeastRequested(t *testing.T) {
expectedList
:
[]
HostPriority
{{
"machine1"
,
37
/* int(75% / 2) */
},
{
"machine2"
,
62
/* int( 75% + 50% / 2) */
}},
test
:
"no resources requested"
,
pods
:
[]
api
.
Pod
{
{
DesiredState
:
cpuOnly
,
CurrentState
:
machine1State
},
{
DesiredState
:
cpuAndMemory
,
CurrentState
:
machine2State
},
{
DesiredState
:
cpuOnly
},
{
DesiredState
:
cpuAndMemory
},
},
},
{
...
...
@@ -105,8 +107,8 @@ func TestLeastRequested(t *testing.T) {
expectedList
:
[]
HostPriority
{{
"machine1"
,
0
},
{
"machine2"
,
0
}},
test
:
"zero minion resources"
,
pods
:
[]
api
.
Pod
{
{
DesiredState
:
cpuOnly
,
CurrentState
:
machine1State
},
{
DesiredState
:
cpuAndMemory
,
CurrentState
:
machine2State
},
{
DesiredState
:
cpuOnly
},
{
DesiredState
:
cpuAndMemory
},
},
},
}
...
...
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