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
0734d1de
Commit
0734d1de
authored
May 18, 2019
by
JieJhih Jhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle nil extension points
parent
2cd5fc54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
43 deletions
+53
-43
framework.go
pkg/scheduler/framework/v1alpha1/framework.go
+53
-43
No files found.
pkg/scheduler/framework/v1alpha1/framework.go
View file @
0734d1de
...
@@ -84,66 +84,76 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
...
@@ -84,66 +84,76 @@ func NewFramework(r Registry, plugins *config.Plugins, args []config.PluginConfi
f
.
plugins
[
name
]
=
p
f
.
plugins
[
name
]
=
p
}
}
for
_
,
r
:=
range
plugins
.
Reserve
.
Enabled
{
if
plugins
.
Reserve
!=
nil
{
if
pg
,
ok
:=
f
.
plugins
[
r
.
Name
];
ok
{
for
_
,
r
:=
range
plugins
.
Reserve
.
Enabled
{
p
,
ok
:=
pg
.
(
ReservePlugin
)
if
pg
,
ok
:=
f
.
plugins
[
r
.
Name
];
ok
{
if
!
ok
{
p
,
ok
:=
pg
.
(
ReservePlugin
)
return
nil
,
fmt
.
Errorf
(
"plugin %v does not extend reserve plugin"
,
r
.
Name
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"plugin %v does not extend reserve plugin"
,
r
.
Name
)
}
f
.
reservePlugins
=
append
(
f
.
reservePlugins
,
p
)
}
else
{
return
nil
,
fmt
.
Errorf
(
"reserve plugin %v does not exist"
,
r
.
Name
)
}
}
f
.
reservePlugins
=
append
(
f
.
reservePlugins
,
p
)
}
else
{
return
nil
,
fmt
.
Errorf
(
"reserve plugin %v does not exist"
,
r
.
Name
)
}
}
}
}
for
_
,
pb
:=
range
plugins
.
PreBind
.
Enabled
{
if
plugins
.
PreBind
!=
nil
{
if
pg
,
ok
:=
f
.
plugins
[
pb
.
Name
];
ok
{
for
_
,
pb
:=
range
plugins
.
PreBind
.
Enabled
{
p
,
ok
:=
pg
.
(
PrebindPlugin
)
if
pg
,
ok
:=
f
.
plugins
[
pb
.
Name
];
ok
{
if
!
ok
{
p
,
ok
:=
pg
.
(
PrebindPlugin
)
return
nil
,
fmt
.
Errorf
(
"plugin %v does not extend prebind plugin"
,
pb
.
Name
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"plugin %v does not extend prebind plugin"
,
pb
.
Name
)
}
f
.
prebindPlugins
=
append
(
f
.
prebindPlugins
,
p
)
}
else
{
return
nil
,
fmt
.
Errorf
(
"prebind plugin %v does not exist"
,
pb
.
Name
)
}
}
f
.
prebindPlugins
=
append
(
f
.
prebindPlugins
,
p
)
}
else
{
return
nil
,
fmt
.
Errorf
(
"prebind plugin %v does not exist"
,
pb
.
Name
)
}
}
}
}
for
_
,
ur
:=
range
plugins
.
Unreserve
.
Enabled
{
if
plugins
.
Unreserve
!=
nil
{
if
pg
,
ok
:=
f
.
plugins
[
ur
.
Name
];
ok
{
for
_
,
ur
:=
range
plugins
.
Unreserve
.
Enabled
{
p
,
ok
:=
pg
.
(
UnreservePlugin
)
if
pg
,
ok
:=
f
.
plugins
[
ur
.
Name
];
ok
{
if
!
ok
{
p
,
ok
:=
pg
.
(
UnreservePlugin
)
return
nil
,
fmt
.
Errorf
(
"plugin %v does not extend unreserve plugin"
,
ur
.
Name
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"plugin %v does not extend unreserve plugin"
,
ur
.
Name
)
}
f
.
unreservePlugins
=
append
(
f
.
unreservePlugins
,
p
)
}
else
{
return
nil
,
fmt
.
Errorf
(
"unreserve plugin %v does not exist"
,
ur
.
Name
)
}
}
f
.
unreservePlugins
=
append
(
f
.
unreservePlugins
,
p
)
}
else
{
return
nil
,
fmt
.
Errorf
(
"unreserve plugin %v does not exist"
,
ur
.
Name
)
}
}
}
}
for
_
,
pr
:=
range
plugins
.
Permit
.
Enabled
{
if
plugins
.
Permit
!=
nil
{
if
pg
,
ok
:=
f
.
plugins
[
pr
.
Name
];
ok
{
for
_
,
pr
:=
range
plugins
.
Permit
.
Enabled
{
p
,
ok
:=
pg
.
(
PermitPlugin
)
if
pg
,
ok
:=
f
.
plugins
[
pr
.
Name
];
ok
{
if
!
ok
{
p
,
ok
:=
pg
.
(
PermitPlugin
)
return
nil
,
fmt
.
Errorf
(
"plugin %v does not extend permit plugin"
,
pr
.
Name
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"plugin %v does not extend permit plugin"
,
pr
.
Name
)
}
f
.
permitPlugins
=
append
(
f
.
permitPlugins
,
p
)
}
else
{
return
nil
,
fmt
.
Errorf
(
"permit plugin %v does not exist"
,
pr
.
Name
)
}
}
f
.
permitPlugins
=
append
(
f
.
permitPlugins
,
p
)
}
else
{
return
nil
,
fmt
.
Errorf
(
"permit plugin %v does not exist"
,
pr
.
Name
)
}
}
}
}
for
_
,
qs
:=
range
plugins
.
QueueSort
.
Enabled
{
if
plugins
.
QueueSort
!=
nil
{
if
pg
,
ok
:=
f
.
plugins
[
qs
.
Name
];
ok
{
for
_
,
qs
:=
range
plugins
.
QueueSort
.
Enabled
{
p
,
ok
:=
pg
.
(
QueueSortPlugin
)
if
pg
,
ok
:=
f
.
plugins
[
qs
.
Name
];
ok
{
if
!
ok
{
p
,
ok
:=
pg
.
(
QueueSortPlugin
)
return
nil
,
fmt
.
Errorf
(
"plugin %v does not extend queue sort plugin"
,
qs
.
Name
)
if
!
ok
{
}
return
nil
,
fmt
.
Errorf
(
"plugin %v does not extend queue sort plugin"
,
qs
.
Name
)
f
.
queueSortPlugins
=
append
(
f
.
queueSortPlugins
,
p
)
}
if
len
(
f
.
queueSortPlugins
)
>
1
{
f
.
queueSortPlugins
=
append
(
f
.
queueSortPlugins
,
p
)
return
nil
,
fmt
.
Errorf
(
"only one queue sort plugin can be enabled"
)
if
len
(
f
.
queueSortPlugins
)
>
1
{
return
nil
,
fmt
.
Errorf
(
"only one queue sort plugin can be enabled"
)
}
}
else
{
return
nil
,
fmt
.
Errorf
(
"queue sort plugin %v does not exist"
,
qs
.
Name
)
}
}
}
else
{
return
nil
,
fmt
.
Errorf
(
"queue sort plugin %v does not exist"
,
qs
.
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