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
ea3e6768
Commit
ea3e6768
authored
Sep 18, 2018
by
Avesh Agarwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix DS tests to set their namespaces to empty node selectors
so that they keep working with PodNodeSelector plugin.
parent
be74187a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
daemon_set.go
test/e2e/apps/daemon_set.go
+31
-1
No files found.
test/e2e/apps/daemon_set.go
View file @
ea3e6768
...
...
@@ -53,6 +53,10 @@ const (
daemonsetColorLabel
=
daemonsetLabelPrefix
+
"color"
)
// The annotation key scheduler.alpha.kubernetes.io/node-selector is for assigning
// node selectors labels to namespaces
var
NamespaceNodeSelectors
=
[]
string
{
"scheduler.alpha.kubernetes.io/node-selector"
}
// This test must be run in serial because it assumes the Daemon Set pods will
// always get scheduled. If we run other tests in parallel, this may not
// happen. In the future, running in parallel may work if we have an eviction
...
...
@@ -99,7 +103,13 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
ns
=
f
.
Namespace
.
Name
c
=
f
.
ClientSet
err
:=
clearDaemonSetNodeLabels
(
c
)
updatedNS
,
err
:=
updateNamespaceAnnotations
(
c
,
ns
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
ns
=
updatedNS
.
Name
err
=
clearDaemonSetNodeLabels
(
c
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
})
...
...
@@ -494,6 +504,26 @@ func clearDaemonSetNodeLabels(c clientset.Interface) error {
return
nil
}
// updateNamespaceAnnotations sets node selectors related annotations on tests namespaces to empty
func
updateNamespaceAnnotations
(
c
clientset
.
Interface
,
nsName
string
)
(
*
v1
.
Namespace
,
error
)
{
nsClient
:=
c
.
CoreV1
()
.
Namespaces
()
ns
,
err
:=
nsClient
.
Get
(
nsName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
nil
,
err
}
if
ns
.
Annotations
==
nil
{
ns
.
Annotations
=
make
(
map
[
string
]
string
)
}
for
_
,
n
:=
range
NamespaceNodeSelectors
{
ns
.
Annotations
[
n
]
=
""
}
return
nsClient
.
Update
(
ns
)
}
func
setDaemonSetNodeLabels
(
c
clientset
.
Interface
,
nodeName
string
,
labels
map
[
string
]
string
)
(
*
v1
.
Node
,
error
)
{
nodeClient
:=
c
.
CoreV1
()
.
Nodes
()
var
newNode
*
v1
.
Node
...
...
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