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
1c60898b
Commit
1c60898b
authored
Oct 19, 2017
by
Yang Guo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow absent Weight if PrioritizeVerb is empty
parent
f07b359e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
validation.go
plugin/pkg/scheduler/api/validation/validation.go
+1
-1
validation_test.go
plugin/pkg/scheduler/api/validation/validation_test.go
+8
-4
No files found.
plugin/pkg/scheduler/api/validation/validation.go
View file @
1c60898b
...
@@ -36,7 +36,7 @@ func ValidatePolicy(policy schedulerapi.Policy) error {
...
@@ -36,7 +36,7 @@ func ValidatePolicy(policy schedulerapi.Policy) error {
binders
:=
0
binders
:=
0
for
_
,
extender
:=
range
policy
.
ExtenderConfigs
{
for
_
,
extender
:=
range
policy
.
ExtenderConfigs
{
if
extender
.
Weight
<=
0
{
if
len
(
extender
.
PrioritizeVerb
)
>
0
&&
extender
.
Weight
<=
0
{
validationErrors
=
append
(
validationErrors
,
fmt
.
Errorf
(
"Priority for extender %s should have a positive weight applied to it"
,
extender
.
URLPrefix
))
validationErrors
=
append
(
validationErrors
,
fmt
.
Errorf
(
"Priority for extender %s should have a positive weight applied to it"
,
extender
.
URLPrefix
))
}
}
if
extender
.
BindVerb
!=
""
{
if
extender
.
BindVerb
!=
""
{
...
...
plugin/pkg/scheduler/api/validation/validation_test.go
View file @
1c60898b
...
@@ -50,18 +50,22 @@ func TestValidatePolicy(t *testing.T) {
...
@@ -50,18 +50,22 @@ func TestValidatePolicy(t *testing.T) {
expected
:
errors
.
New
(
"Priority WeightPriority should have a positive weight applied to it or it has overflown"
),
expected
:
errors
.
New
(
"Priority WeightPriority should have a positive weight applied to it or it has overflown"
),
},
},
{
{
policy
:
api
.
Policy
{
ExtenderConfigs
:
[]
api
.
ExtenderConfig
{{
URLPrefix
:
"http://127.0.0.1:8081/extender"
,
FilterVerb
:
"filter
"
,
Weight
:
2
}}},
policy
:
api
.
Policy
{
ExtenderConfigs
:
[]
api
.
ExtenderConfig
{{
URLPrefix
:
"http://127.0.0.1:8081/extender"
,
PrioritizeVerb
:
"prioritize
"
,
Weight
:
2
}}},
expected
:
nil
,
expected
:
nil
,
},
},
{
{
policy
:
api
.
Policy
{
ExtenderConfigs
:
[]
api
.
ExtenderConfig
{{
URLPrefix
:
"http://127.0.0.1:8081/extender"
,
FilterVerb
:
"filter
"
,
Weight
:
-
2
}}},
policy
:
api
.
Policy
{
ExtenderConfigs
:
[]
api
.
ExtenderConfig
{{
URLPrefix
:
"http://127.0.0.1:8081/extender"
,
PrioritizeVerb
:
"prioritize
"
,
Weight
:
-
2
}}},
expected
:
errors
.
New
(
"Priority for extender http://127.0.0.1:8081/extender should have a positive weight applied to it"
),
expected
:
errors
.
New
(
"Priority for extender http://127.0.0.1:8081/extender should have a positive weight applied to it"
),
},
},
{
{
policy
:
api
.
Policy
{
ExtenderConfigs
:
[]
api
.
ExtenderConfig
{{
URLPrefix
:
"http://127.0.0.1:8081/extender"
,
FilterVerb
:
"filter"
}}},
expected
:
nil
,
},
{
policy
:
api
.
Policy
{
policy
:
api
.
Policy
{
ExtenderConfigs
:
[]
api
.
ExtenderConfig
{
ExtenderConfigs
:
[]
api
.
ExtenderConfig
{
{
URLPrefix
:
"http://127.0.0.1:8081/extender"
,
BindVerb
:
"bind"
,
Weight
:
2
},
{
URLPrefix
:
"http://127.0.0.1:8081/extender"
,
BindVerb
:
"bind"
},
{
URLPrefix
:
"http://127.0.0.1:8082/extender"
,
BindVerb
:
"bind"
,
Weight
:
2
},
{
URLPrefix
:
"http://127.0.0.1:8082/extender"
,
BindVerb
:
"bind"
},
}},
}},
expected
:
errors
.
New
(
"Only one extender can implement bind, found 2"
),
expected
:
errors
.
New
(
"Only one extender can implement bind, found 2"
),
},
},
...
...
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