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
7219802a
Commit
7219802a
authored
Jul 07, 2016
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass pointer to node in NodCondition
parent
58c95c13
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
8 deletions
+8
-8
listers.go
pkg/client/cache/listers.go
+3
-3
listers_test.go
pkg/client/cache/listers_test.go
+1
-1
servicecontroller.go
pkg/controller/service/servicecontroller.go
+1
-1
servicecontroller_test.go
pkg/controller/service/servicecontroller_test.go
+1
-1
factory.go
plugin/pkg/scheduler/factory/factory.go
+1
-1
factory_test.go
plugin/pkg/scheduler/factory/factory_test.go
+1
-1
No files found.
pkg/client/cache/listers.go
View file @
7219802a
...
@@ -122,7 +122,7 @@ func (s *StoreToPodLister) Exists(pod *api.Pod) (bool, error) {
...
@@ -122,7 +122,7 @@ func (s *StoreToPodLister) Exists(pod *api.Pod) (bool, error) {
// NodeConditionPredicate is a function that indicates whether the given node's conditions meet
// NodeConditionPredicate is a function that indicates whether the given node's conditions meet
// some set of criteria defined by the function.
// some set of criteria defined by the function.
type
NodeConditionPredicate
func
(
node
api
.
Node
)
bool
type
NodeConditionPredicate
func
(
node
*
api
.
Node
)
bool
// StoreToNodeLister makes a Store have the List method of the client.NodeInterface
// StoreToNodeLister makes a Store have the List method of the client.NodeInterface
// The Store must contain (only) Nodes.
// The Store must contain (only) Nodes.
...
@@ -153,9 +153,9 @@ type storeToNodeConditionLister struct {
...
@@ -153,9 +153,9 @@ type storeToNodeConditionLister struct {
// List returns a list of nodes that match the conditions defined by the predicate functions in the storeToNodeConditionLister.
// List returns a list of nodes that match the conditions defined by the predicate functions in the storeToNodeConditionLister.
func
(
s
storeToNodeConditionLister
)
List
()
(
nodes
api
.
NodeList
,
err
error
)
{
func
(
s
storeToNodeConditionLister
)
List
()
(
nodes
api
.
NodeList
,
err
error
)
{
for
_
,
m
:=
range
s
.
store
.
List
()
{
for
_
,
m
:=
range
s
.
store
.
List
()
{
node
:=
*
m
.
(
*
api
.
Node
)
node
:=
m
.
(
*
api
.
Node
)
if
s
.
predicate
(
node
)
{
if
s
.
predicate
(
node
)
{
nodes
.
Items
=
append
(
nodes
.
Items
,
node
)
nodes
.
Items
=
append
(
nodes
.
Items
,
*
node
)
}
else
{
}
else
{
glog
.
V
(
5
)
.
Infof
(
"Node %s matches none of the conditions"
,
node
.
Name
)
glog
.
V
(
5
)
.
Infof
(
"Node %s matches none of the conditions"
,
node
.
Name
)
}
}
...
...
pkg/client/cache/listers_test.go
View file @
7219802a
...
@@ -97,7 +97,7 @@ func TestStoreToNodeConditionLister(t *testing.T) {
...
@@ -97,7 +97,7 @@ func TestStoreToNodeConditionLister(t *testing.T) {
store
.
Add
(
n
)
store
.
Add
(
n
)
}
}
predicate
:=
func
(
node
api
.
Node
)
bool
{
predicate
:=
func
(
node
*
api
.
Node
)
bool
{
for
_
,
cond
:=
range
node
.
Status
.
Conditions
{
for
_
,
cond
:=
range
node
.
Status
.
Conditions
{
if
cond
.
Type
==
api
.
NodeOutOfDisk
&&
cond
.
Status
==
api
.
ConditionTrue
{
if
cond
.
Type
==
api
.
NodeOutOfDisk
&&
cond
.
Status
==
api
.
ConditionTrue
{
return
false
return
false
...
...
pkg/controller/service/servicecontroller.go
View file @
7219802a
...
@@ -641,7 +641,7 @@ func hostsFromNodeList(list *api.NodeList) []string {
...
@@ -641,7 +641,7 @@ func hostsFromNodeList(list *api.NodeList) []string {
}
}
func
getNodeConditionPredicate
()
cache
.
NodeConditionPredicate
{
func
getNodeConditionPredicate
()
cache
.
NodeConditionPredicate
{
return
func
(
node
api
.
Node
)
bool
{
return
func
(
node
*
api
.
Node
)
bool
{
// We add the master to the node list, but its unschedulable. So we use this to filter
// We add the master to the node list, but its unschedulable. So we use this to filter
// the master.
// the master.
// TODO: Use a node annotation to indicate the master
// TODO: Use a node annotation to indicate the master
...
...
pkg/controller/service/servicecontroller_test.go
View file @
7219802a
...
@@ -319,7 +319,7 @@ func TestGetNodeConditionPredicate(t *testing.T) {
...
@@ -319,7 +319,7 @@ func TestGetNodeConditionPredicate(t *testing.T) {
}
}
pred
:=
getNodeConditionPredicate
()
pred
:=
getNodeConditionPredicate
()
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
accept
:=
pred
(
test
.
node
)
accept
:=
pred
(
&
test
.
node
)
if
accept
!=
test
.
expectAccept
{
if
accept
!=
test
.
expectAccept
{
t
.
Errorf
(
"Test failed for %s, expected %v, saw %v"
,
test
.
name
,
test
.
expectAccept
,
accept
)
t
.
Errorf
(
"Test failed for %s, expected %v, saw %v"
,
test
.
name
,
test
.
expectAccept
,
accept
)
}
}
...
...
plugin/pkg/scheduler/factory/factory.go
View file @
7219802a
...
@@ -432,7 +432,7 @@ func (f *ConfigFactory) responsibleForPod(pod *api.Pod) bool {
...
@@ -432,7 +432,7 @@ func (f *ConfigFactory) responsibleForPod(pod *api.Pod) bool {
}
}
func
getNodeConditionPredicate
()
cache
.
NodeConditionPredicate
{
func
getNodeConditionPredicate
()
cache
.
NodeConditionPredicate
{
return
func
(
node
api
.
Node
)
bool
{
return
func
(
node
*
api
.
Node
)
bool
{
for
_
,
cond
:=
range
node
.
Status
.
Conditions
{
for
_
,
cond
:=
range
node
.
Status
.
Conditions
{
// We consider the node for scheduling only when its:
// We consider the node for scheduling only when its:
// - NodeReady condition status is ConditionTrue,
// - NodeReady condition status is ConditionTrue,
...
...
plugin/pkg/scheduler/factory/factory_test.go
View file @
7219802a
...
@@ -464,7 +464,7 @@ func TestNodeConditionPredicate(t *testing.T) {
...
@@ -464,7 +464,7 @@ func TestNodeConditionPredicate(t *testing.T) {
nodeNames
:=
[]
string
{}
nodeNames
:=
[]
string
{}
for
_
,
node
:=
range
nodeList
.
Items
{
for
_
,
node
:=
range
nodeList
.
Items
{
if
nodeFunc
(
node
)
{
if
nodeFunc
(
&
node
)
{
nodeNames
=
append
(
nodeNames
,
node
.
Name
)
nodeNames
=
append
(
nodeNames
,
node
.
Name
)
}
}
}
}
...
...
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