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
0b3a6c80
Commit
0b3a6c80
authored
Mar 10, 2017
by
Haoran Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial the scheduler priority test
parent
7ff948ce
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
0 deletions
+54
-0
util.go
test/e2e/framework/util.go
+50
-0
BUILD
test/e2e/scheduling/BUILD
+2
-0
predicates.go
test/e2e/scheduling/predicates.go
+2
-0
priorities.go
test/e2e/scheduling/priorities.go
+0
-0
No files found.
test/e2e/framework/util.go
View file @
0b3a6c80
...
@@ -19,6 +19,7 @@ package framework
...
@@ -19,6 +19,7 @@ package framework
import
(
import
(
"bytes"
"bytes"
"context"
"context"
"encoding/json"
"errors"
"errors"
"fmt"
"fmt"
"io"
"io"
...
@@ -2601,6 +2602,55 @@ func NodeHasTaint(c clientset.Interface, nodeName string, taint *v1.Taint) (bool
...
@@ -2601,6 +2602,55 @@ func NodeHasTaint(c clientset.Interface, nodeName string, taint *v1.Taint) (bool
return
true
,
nil
return
true
,
nil
}
}
//AddOrUpdateAvoidPodOnNode adds avoidPods annotations to node, will override if it exists
func
AddOrUpdateAvoidPodOnNode
(
c
clientset
.
Interface
,
nodeName
string
,
avoidPods
v1
.
AvoidPods
)
{
err
:=
wait
.
PollImmediate
(
Poll
,
SingleCallTimeout
,
func
()
(
bool
,
error
)
{
node
,
err
:=
c
.
CoreV1
()
.
Nodes
()
.
Get
(
nodeName
,
metav1
.
GetOptions
{})
ExpectNoError
(
err
)
taintsData
,
err
:=
json
.
Marshal
(
avoidPods
)
ExpectNoError
(
err
)
if
node
.
Annotations
==
nil
{
node
.
Annotations
=
make
(
map
[
string
]
string
)
}
node
.
Annotations
[
v1
.
PreferAvoidPodsAnnotationKey
]
=
string
(
taintsData
)
_
,
err
=
c
.
CoreV1
()
.
Nodes
()
.
Update
(
node
)
if
err
!=
nil
{
if
!
apierrs
.
IsConflict
(
err
)
{
ExpectNoError
(
err
)
}
else
{
Logf
(
"Conflict when trying to add/update avoidPonds %v to %v"
,
avoidPods
,
nodeName
)
}
}
return
true
,
nil
})
ExpectNoError
(
err
)
}
//RemoveAnnotationOffNode removes AvoidPods annotations from the node. It does not fail if no such annotation exists.
func
RemoveAvoidPodsOffNode
(
c
clientset
.
Interface
,
nodeName
string
)
{
err
:=
wait
.
PollImmediate
(
Poll
,
SingleCallTimeout
,
func
()
(
bool
,
error
)
{
node
,
err
:=
c
.
CoreV1
()
.
Nodes
()
.
Get
(
nodeName
,
metav1
.
GetOptions
{})
ExpectNoError
(
err
)
if
node
.
Annotations
==
nil
{
return
true
,
nil
}
delete
(
node
.
Annotations
,
v1
.
PreferAvoidPodsAnnotationKey
)
_
,
err
=
c
.
CoreV1
()
.
Nodes
()
.
Update
(
node
)
if
err
!=
nil
{
if
!
apierrs
.
IsConflict
(
err
)
{
ExpectNoError
(
err
)
}
else
{
Logf
(
"Conflict when trying to remove avoidPods to %v"
,
nodeName
)
}
}
return
true
,
nil
})
ExpectNoError
(
err
)
}
func
getScalerForKind
(
internalClientset
internalclientset
.
Interface
,
kind
schema
.
GroupKind
)
(
kubectl
.
Scaler
,
error
)
{
func
getScalerForKind
(
internalClientset
internalclientset
.
Interface
,
kind
schema
.
GroupKind
)
(
kubectl
.
Scaler
,
error
)
{
return
kubectl
.
ScalerFor
(
kind
,
internalClientset
)
return
kubectl
.
ScalerFor
(
kind
,
internalClientset
)
}
}
...
...
test/e2e/scheduling/BUILD
View file @
0b3a6c80
...
@@ -13,6 +13,7 @@ go_library(
...
@@ -13,6 +13,7 @@ go_library(
"events.go",
"events.go",
"opaque_resource.go",
"opaque_resource.go",
"predicates.go",
"predicates.go",
"priorities.go",
"rescheduler.go",
"rescheduler.go",
],
],
tags = ["automanaged"],
tags = ["automanaged"],
...
@@ -20,6 +21,7 @@ go_library(
...
@@ -20,6 +21,7 @@ go_library(
"//pkg/api/v1:go_default_library",
"//pkg/api/v1:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/util/system:go_default_library",
"//pkg/util/system:go_default_library",
"//plugin/pkg/scheduler/algorithm/priorities/util:go_default_library",
"//test/e2e/common:go_default_library",
"//test/e2e/common:go_default_library",
"//test/e2e/framework:go_default_library",
"//test/e2e/framework:go_default_library",
"//test/utils:go_default_library",
"//test/utils:go_default_library",
...
...
test/e2e/scheduling/predicates.go
View file @
0b3a6c80
...
@@ -48,6 +48,7 @@ type pausePodConfig struct {
...
@@ -48,6 +48,7 @@ type pausePodConfig struct {
Annotations
,
Labels
,
NodeSelector
map
[
string
]
string
Annotations
,
Labels
,
NodeSelector
map
[
string
]
string
Resources
*
v1
.
ResourceRequirements
Resources
*
v1
.
ResourceRequirements
Tolerations
[]
v1
.
Toleration
Tolerations
[]
v1
.
Toleration
NodeName
string
}
}
var
_
=
framework
.
KubeDescribe
(
"SchedulerPredicates [Serial]"
,
func
()
{
var
_
=
framework
.
KubeDescribe
(
"SchedulerPredicates [Serial]"
,
func
()
{
...
@@ -757,6 +758,7 @@ func initPausePod(f *framework.Framework, conf pausePodConfig) *v1.Pod {
...
@@ -757,6 +758,7 @@ func initPausePod(f *framework.Framework, conf pausePodConfig) *v1.Pod {
},
},
},
},
Tolerations
:
conf
.
Tolerations
,
Tolerations
:
conf
.
Tolerations
,
NodeName
:
conf
.
NodeName
,
},
},
}
}
if
conf
.
Resources
!=
nil
{
if
conf
.
Resources
!=
nil
{
...
...
test/e2e/scheduling/priorities.go
0 → 100644
View file @
0b3a6c80
This diff is collapsed.
Click to expand it.
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