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
b5b5b511
Commit
b5b5b511
authored
Jun 06, 2017
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add e2e test for DaemonSet history oraphn/adoption
parent
0035d862
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
daemon_set.go
test/e2e/daemon_set.go
+33
-1
No files found.
test/e2e/daemon_set.go
View file @
b5b5b511
...
...
@@ -387,6 +387,8 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
wait
.
PollImmediate
(
dsRetryPeriod
,
dsRetryTimeout
,
checkDaemonSetPodsOrphaned
(
c
,
ns
,
label
))
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error waiting for DaemonSet pods to be orphaned"
)
err
=
wait
.
PollImmediate
(
dsRetryPeriod
,
dsRetryTimeout
,
checkDaemonSetHistoryOrphaned
(
c
,
ns
,
label
))
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error waiting for DaemonSet history to be orphaned"
)
err
=
wait
.
PollImmediate
(
dsRetryPeriod
,
dsRetryTimeout
,
checkDaemonSetDeleted
(
f
,
ns
,
ds
.
Name
))
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error waiting for DaemonSet to be deleted"
)
...
...
@@ -402,7 +404,9 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
By
(
fmt
.
Sprintf
(
"Wait for all pods to be adopted by DaemonSet %s"
,
newDSName
))
err
=
wait
.
PollImmediate
(
dsRetryPeriod
,
dsRetryTimeout
,
checkDaemonSetPodsAdopted
(
c
,
ns
,
newDS
.
UID
,
label
))
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error waiting for DaemonSet pods to be orphaned"
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error waiting for DaemonSet pods to be adopted"
)
err
=
wait
.
PollImmediate
(
dsRetryPeriod
,
dsRetryTimeout
,
checkDaemonSetHistoryAdopted
(
c
,
ns
,
newDS
.
UID
,
label
))
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error waiting for DaemonSet history to be adopted"
)
By
(
fmt
.
Sprintf
(
"Make sure no daemon pod updated its template generation %d"
,
templateGeneration
))
err
=
checkDaemonPodsTemplateGeneration
(
c
,
ns
,
label
,
fmt
.
Sprint
(
templateGeneration
))
...
...
@@ -418,6 +422,8 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
wait
.
PollImmediate
(
dsRetryPeriod
,
dsRetryTimeout
,
checkDaemonSetPodsOrphaned
(
c
,
ns
,
label
))
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error waiting for DaemonSet pods to be orphaned"
)
err
=
wait
.
PollImmediate
(
dsRetryPeriod
,
dsRetryTimeout
,
checkDaemonSetHistoryOrphaned
(
c
,
ns
,
label
))
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error waiting for DaemonSet history to be orphaned"
)
err
=
wait
.
PollImmediate
(
dsRetryPeriod
,
dsRetryTimeout
,
checkDaemonSetDeleted
(
f
,
ns
,
newDSName
))
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error waiting for DaemonSet to be deleted"
)
...
...
@@ -705,6 +711,19 @@ func checkDaemonSetPodsOrphaned(c clientset.Interface, ns string, label map[stri
}
}
func
checkDaemonSetHistoryOrphaned
(
c
clientset
.
Interface
,
ns
string
,
label
map
[
string
]
string
)
func
()
(
bool
,
error
)
{
return
func
()
(
bool
,
error
)
{
histories
:=
listDaemonHistories
(
c
,
ns
,
label
)
for
_
,
history
:=
range
histories
.
Items
{
// This history is orphaned only when controller ref is cleared
if
controllerRef
:=
controller
.
GetControllerOf
(
&
history
);
controllerRef
!=
nil
{
return
false
,
nil
}
}
return
true
,
nil
}
}
func
checkDaemonSetPodsAdopted
(
c
clientset
.
Interface
,
ns
string
,
dsUID
types
.
UID
,
label
map
[
string
]
string
)
func
()
(
bool
,
error
)
{
return
func
()
(
bool
,
error
)
{
pods
:=
listDaemonPods
(
c
,
ns
,
label
)
...
...
@@ -718,6 +737,19 @@ func checkDaemonSetPodsAdopted(c clientset.Interface, ns string, dsUID types.UID
}
}
func
checkDaemonSetHistoryAdopted
(
c
clientset
.
Interface
,
ns
string
,
dsUID
types
.
UID
,
label
map
[
string
]
string
)
func
()
(
bool
,
error
)
{
return
func
()
(
bool
,
error
)
{
histories
:=
listDaemonHistories
(
c
,
ns
,
label
)
for
_
,
history
:=
range
histories
.
Items
{
// This history is adopted only when its controller ref is update
if
controllerRef
:=
controller
.
GetControllerOf
(
&
history
);
controllerRef
==
nil
||
controllerRef
.
UID
!=
dsUID
{
return
false
,
nil
}
}
return
true
,
nil
}
}
func
checkDaemonSetPodsNameMatch
(
c
clientset
.
Interface
,
ns
,
prefix
string
,
label
map
[
string
]
string
)
func
()
(
bool
,
error
)
{
return
func
()
(
bool
,
error
)
{
if
err
:=
checkDaemonSetPodsName
(
c
,
ns
,
prefix
,
label
);
err
!=
nil
{
...
...
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