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
5f2555e3
Commit
5f2555e3
authored
Oct 09, 2018
by
Bobby (Babak) Salamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove pod status.phase check from pod event handlers
parent
830e09cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
24 deletions
+7
-24
factory.go
pkg/scheduler/factory/factory.go
+7
-24
No files found.
pkg/scheduler/factory/factory.go
View file @
5f2555e3
...
...
@@ -202,10 +202,10 @@ func NewConfigFactory(args *ConfigFactoryArgs) scheduler.Configurator {
FilterFunc
:
func
(
obj
interface
{})
bool
{
switch
t
:=
obj
.
(
type
)
{
case
*
v1
.
Pod
:
return
assigned
NonTerminated
Pod
(
t
)
return
assignedPod
(
t
)
case
cache
.
DeletedFinalStateUnknown
:
if
pod
,
ok
:=
t
.
Obj
.
(
*
v1
.
Pod
);
ok
{
return
assigned
NonTerminated
Pod
(
pod
)
return
assignedPod
(
pod
)
}
runtime
.
HandleError
(
fmt
.
Errorf
(
"unable to convert object %T to *v1.Pod in %T"
,
obj
,
c
))
return
false
...
...
@@ -227,10 +227,10 @@ func NewConfigFactory(args *ConfigFactoryArgs) scheduler.Configurator {
FilterFunc
:
func
(
obj
interface
{})
bool
{
switch
t
:=
obj
.
(
type
)
{
case
*
v1
.
Pod
:
return
unassignedNonTerminat
edPod
(
t
)
&&
responsibleForPod
(
t
,
args
.
SchedulerName
)
return
!
assign
edPod
(
t
)
&&
responsibleForPod
(
t
,
args
.
SchedulerName
)
case
cache
.
DeletedFinalStateUnknown
:
if
pod
,
ok
:=
t
.
Obj
.
(
*
v1
.
Pod
);
ok
{
return
unassignedNonTerminat
edPod
(
pod
)
&&
responsibleForPod
(
pod
,
args
.
SchedulerName
)
return
!
assign
edPod
(
pod
)
&&
responsibleForPod
(
pod
,
args
.
SchedulerName
)
}
runtime
.
HandleError
(
fmt
.
Errorf
(
"unable to convert object %T to *v1.Pod in %T"
,
obj
,
c
))
return
false
...
...
@@ -1240,26 +1240,9 @@ func (c *configFactory) getNextPod() *v1.Pod {
return
nil
}
// unassignedNonTerminatedPod selects pods that are unassigned and non-terminal.
func
unassignedNonTerminatedPod
(
pod
*
v1
.
Pod
)
bool
{
if
len
(
pod
.
Spec
.
NodeName
)
!=
0
{
return
false
}
if
pod
.
Status
.
Phase
==
v1
.
PodSucceeded
||
pod
.
Status
.
Phase
==
v1
.
PodFailed
{
return
false
}
return
true
}
// assignedNonTerminatedPod selects pods that are assigned and non-terminal (scheduled and running).
func
assignedNonTerminatedPod
(
pod
*
v1
.
Pod
)
bool
{
if
len
(
pod
.
Spec
.
NodeName
)
==
0
{
return
false
}
if
pod
.
Status
.
Phase
==
v1
.
PodSucceeded
||
pod
.
Status
.
Phase
==
v1
.
PodFailed
{
return
false
}
return
true
// assignedPod selects pods that are assigned (scheduled and running).
func
assignedPod
(
pod
*
v1
.
Pod
)
bool
{
return
len
(
pod
.
Spec
.
NodeName
)
!=
0
}
// responsibleForPod returns true if the pod has asked to be scheduled by the given scheduler.
...
...
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