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
9bd720b3
Commit
9bd720b3
authored
Oct 31, 2017
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug checking DaemonSet pods are updated in e2e test
parent
09d896bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
daemon_set.go
test/e2e/apps/daemon_set.go
+24
-14
No files found.
test/e2e/apps/daemon_set.go
View file @
9bd720b3
...
@@ -660,20 +660,25 @@ func checkDaemonPodOnNodes(f *framework.Framework, ds *extensions.DaemonSet, nod
...
@@ -660,20 +660,25 @@ func checkDaemonPodOnNodes(f *framework.Framework, ds *extensions.DaemonSet, nod
func
checkRunningOnAllNodes
(
f
*
framework
.
Framework
,
ds
*
extensions
.
DaemonSet
)
func
()
(
bool
,
error
)
{
func
checkRunningOnAllNodes
(
f
*
framework
.
Framework
,
ds
*
extensions
.
DaemonSet
)
func
()
(
bool
,
error
)
{
return
func
()
(
bool
,
error
)
{
return
func
()
(
bool
,
error
)
{
nodeList
,
err
:=
f
.
ClientSet
.
CoreV1
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
nodeNames
:=
schedulableNodes
(
f
.
ClientSet
,
ds
)
framework
.
ExpectNoError
(
err
)
nodeNames
:=
make
([]
string
,
0
)
for
_
,
node
:=
range
nodeList
.
Items
{
if
!
canScheduleOnNode
(
node
,
ds
)
{
framework
.
Logf
(
"DaemonSet pods can't tolerate node %s with taints %+v, skip checking this node"
,
node
.
Name
,
node
.
Spec
.
Taints
)
continue
}
nodeNames
=
append
(
nodeNames
,
node
.
Name
)
}
return
checkDaemonPodOnNodes
(
f
,
ds
,
nodeNames
)()
return
checkDaemonPodOnNodes
(
f
,
ds
,
nodeNames
)()
}
}
}
}
func
schedulableNodes
(
c
clientset
.
Interface
,
ds
*
extensions
.
DaemonSet
)
[]
string
{
nodeList
,
err
:=
c
.
CoreV1
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
framework
.
ExpectNoError
(
err
)
nodeNames
:=
make
([]
string
,
0
)
for
_
,
node
:=
range
nodeList
.
Items
{
if
!
canScheduleOnNode
(
node
,
ds
)
{
framework
.
Logf
(
"DaemonSet pods can't tolerate node %s with taints %+v, skip checking this node"
,
node
.
Name
,
node
.
Spec
.
Taints
)
continue
}
nodeNames
=
append
(
nodeNames
,
node
.
Name
)
}
return
nodeNames
}
func
checkAtLeastOneNewPod
(
c
clientset
.
Interface
,
ns
string
,
label
map
[
string
]
string
,
newImage
string
)
func
()
(
bool
,
error
)
{
func
checkAtLeastOneNewPod
(
c
clientset
.
Interface
,
ns
string
,
label
map
[
string
]
string
,
newImage
string
)
func
()
(
bool
,
error
)
{
return
func
()
(
bool
,
error
)
{
return
func
()
(
bool
,
error
)
{
pods
:=
listDaemonPods
(
c
,
ns
,
label
)
pods
:=
listDaemonPods
(
c
,
ns
,
label
)
...
@@ -724,15 +729,16 @@ func checkDaemonPodsImageAndAvailability(c clientset.Interface, ds *extensions.D
...
@@ -724,15 +729,16 @@ func checkDaemonPodsImageAndAvailability(c clientset.Interface, ds *extensions.D
pods
:=
podList
.
Items
pods
:=
podList
.
Items
unavailablePods
:=
0
unavailablePods
:=
0
allImagesUpdated
:=
true
nodesToUpdatedPodCount
:=
make
(
map
[
string
]
int
)
for
_
,
pod
:=
range
pods
{
for
_
,
pod
:=
range
pods
{
if
!
metav1
.
IsControlledBy
(
&
pod
,
ds
)
{
if
!
metav1
.
IsControlledBy
(
&
pod
,
ds
)
{
continue
continue
}
}
podImage
:=
pod
.
Spec
.
Containers
[
0
]
.
Image
podImage
:=
pod
.
Spec
.
Containers
[
0
]
.
Image
if
podImage
!=
image
{
if
podImage
!=
image
{
allImagesUpdated
=
false
framework
.
Logf
(
"Wrong image for pod: %s. Expected: %s, got: %s."
,
pod
.
Name
,
image
,
podImage
)
framework
.
Logf
(
"Wrong image for pod: %s. Expected: %s, got: %s."
,
pod
.
Name
,
image
,
podImage
)
}
else
{
nodesToUpdatedPodCount
[
pod
.
Spec
.
NodeName
]
+=
1
}
}
if
!
podutil
.
IsPodAvailable
(
&
pod
,
ds
.
Spec
.
MinReadySeconds
,
metav1
.
Now
())
{
if
!
podutil
.
IsPodAvailable
(
&
pod
,
ds
.
Spec
.
MinReadySeconds
,
metav1
.
Now
())
{
framework
.
Logf
(
"Pod %s is not available"
,
pod
.
Name
)
framework
.
Logf
(
"Pod %s is not available"
,
pod
.
Name
)
...
@@ -742,8 +748,12 @@ func checkDaemonPodsImageAndAvailability(c clientset.Interface, ds *extensions.D
...
@@ -742,8 +748,12 @@ func checkDaemonPodsImageAndAvailability(c clientset.Interface, ds *extensions.D
if
unavailablePods
>
maxUnavailable
{
if
unavailablePods
>
maxUnavailable
{
return
false
,
fmt
.
Errorf
(
"number of unavailable pods: %d is greater than maxUnavailable: %d"
,
unavailablePods
,
maxUnavailable
)
return
false
,
fmt
.
Errorf
(
"number of unavailable pods: %d is greater than maxUnavailable: %d"
,
unavailablePods
,
maxUnavailable
)
}
}
if
!
allImagesUpdated
{
// Make sure every daemon pod on the node has been updated
return
false
,
nil
nodeNames
:=
schedulableNodes
(
c
,
ds
)
for
_
,
node
:=
range
nodeNames
{
if
nodesToUpdatedPodCount
[
node
]
==
0
{
return
false
,
nil
}
}
}
return
true
,
nil
return
true
,
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