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
e42bac7c
Commit
e42bac7c
authored
Mar 17, 2017
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In DaemonSet e2e tests, use Patch instead of Update to avoid conflict
parent
44146189
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
daemon_set.go
test/e2e/daemon_set.go
+10
-8
No files found.
test/e2e/daemon_set.go
View file @
e42bac7c
...
@@ -251,9 +251,8 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
...
@@ -251,9 +251,8 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
"Update daemon pods image."
)
By
(
"Update daemon pods image."
)
ds
,
err
=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Get
(
dsName
,
metav1
.
GetOptions
{})
patch
:=
getDaemonSetImagePatch
(
ds
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Name
,
redisImage
)
ds
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
=
redisImage
ds
,
err
=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Patch
(
dsName
,
types
.
StrategicMergePatchType
,
[]
byte
(
patch
))
ds
,
err
=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Update
(
ds
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
ds
.
Spec
.
TemplateGeneration
)
.
To
(
Equal
(
int64
(
2
)))
Expect
(
ds
.
Spec
.
TemplateGeneration
)
.
To
(
Equal
(
int64
(
2
)))
...
@@ -277,6 +276,7 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
...
@@ -277,6 +276,7 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
framework
.
Logf
(
"Creating simple daemon set %s with templateGeneration %d"
,
dsName
,
templateGeneration
)
framework
.
Logf
(
"Creating simple daemon set %s with templateGeneration %d"
,
dsName
,
templateGeneration
)
ds
:=
newDaemonSet
(
dsName
,
image
,
label
)
ds
:=
newDaemonSet
(
dsName
,
image
,
label
)
ds
.
Spec
.
TemplateGeneration
=
templateGeneration
ds
.
Spec
.
TemplateGeneration
=
templateGeneration
ds
.
Spec
.
UpdateStrategy
=
extensions
.
DaemonSetUpdateStrategy
{
Type
:
extensions
.
RollingUpdateDaemonSetStrategyType
}
ds
,
err
:=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Create
(
ds
)
ds
,
err
:=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Create
(
ds
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
ds
.
Spec
.
TemplateGeneration
)
.
To
(
Equal
(
templateGeneration
))
Expect
(
ds
.
Spec
.
TemplateGeneration
)
.
To
(
Equal
(
templateGeneration
))
...
@@ -290,11 +290,8 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
...
@@ -290,11 +290,8 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
"Update daemon pods image."
)
By
(
"Update daemon pods image."
)
ds
,
err
=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Get
(
dsName
,
metav1
.
GetOptions
{})
patch
:=
getDaemonSetImagePatch
(
ds
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Name
,
redisImage
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
ds
,
err
=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Patch
(
dsName
,
types
.
StrategicMergePatchType
,
[]
byte
(
patch
))
ds
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
=
redisImage
ds
.
Spec
.
UpdateStrategy
=
extensions
.
DaemonSetUpdateStrategy
{
Type
:
extensions
.
RollingUpdateDaemonSetStrategyType
}
ds
,
err
=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Update
(
ds
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
ds
.
Spec
.
TemplateGeneration
)
.
To
(
Equal
(
templateGeneration
+
1
))
Expect
(
ds
.
Spec
.
TemplateGeneration
)
.
To
(
Equal
(
templateGeneration
+
1
))
...
@@ -391,6 +388,11 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
...
@@ -391,6 +388,11 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
})
})
})
})
// getDaemonSetImagePatch generates a patch for updating a DaemonSet's container image
func
getDaemonSetImagePatch
(
containerName
,
containerImage
string
)
string
{
return
fmt
.
Sprintf
(
`{"spec":{"template":{"spec":{"containers":[{"name":"%s","image":"%s"}]}}}}`
,
containerName
,
containerImage
)
}
func
orphanDaemonSetPods
(
c
clientset
.
Interface
,
ds
*
extensions
.
DaemonSet
)
error
{
func
orphanDaemonSetPods
(
c
clientset
.
Interface
,
ds
*
extensions
.
DaemonSet
)
error
{
trueVar
:=
true
trueVar
:=
true
deleteOptions
:=
&
metav1
.
DeleteOptions
{
OrphanDependents
:
&
trueVar
}
deleteOptions
:=
&
metav1
.
DeleteOptions
{
OrphanDependents
:
&
trueVar
}
...
...
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