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
fd7a6944
Commit
fd7a6944
authored
Aug 15, 2018
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid unnecessary DaemonSet collisionCount bump
parent
68cfa7ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
update.go
pkg/controller/daemon/update.go
+6
-1
No files found.
pkg/controller/daemon/update.go
View file @
fd7a6944
...
@@ -19,6 +19,7 @@ package daemon
...
@@ -19,6 +19,7 @@ package daemon
import
(
import
(
"bytes"
"bytes"
"fmt"
"fmt"
"reflect"
"sort"
"sort"
"github.com/golang/glog"
"github.com/golang/glog"
...
@@ -346,11 +347,15 @@ func (dsc *DaemonSetsController) snapshot(ds *apps.DaemonSet, revision int64) (*
...
@@ -346,11 +347,15 @@ func (dsc *DaemonSetsController) snapshot(ds *apps.DaemonSet, revision int64) (*
}
}
// Handle name collisions between different history
// Handle name collisions between different history
//
TODO: Is it okay to get from dsLister?
//
Get the latest DaemonSet from the API server to make sure collision count is only increased when necessary
currDS
,
getErr
:=
dsc
.
kubeClient
.
ExtensionsV1beta1
()
.
DaemonSets
(
ds
.
Namespace
)
.
Get
(
ds
.
Name
,
metav1
.
GetOptions
{})
currDS
,
getErr
:=
dsc
.
kubeClient
.
ExtensionsV1beta1
()
.
DaemonSets
(
ds
.
Namespace
)
.
Get
(
ds
.
Name
,
metav1
.
GetOptions
{})
if
getErr
!=
nil
{
if
getErr
!=
nil
{
return
nil
,
getErr
return
nil
,
getErr
}
}
// If the collision count used to compute hash was in fact stale, there's no need to bump collision count; retry again
if
!
reflect
.
DeepEqual
(
currDS
.
Status
.
CollisionCount
,
ds
.
Status
.
CollisionCount
)
{
return
nil
,
fmt
.
Errorf
(
"found a stale collision count (%d, expected %d) of DaemonSet %q while processing; will retry until it is updated"
,
ds
.
Status
.
CollisionCount
,
currDS
.
Status
.
CollisionCount
,
ds
.
Name
)
}
if
currDS
.
Status
.
CollisionCount
==
nil
{
if
currDS
.
Status
.
CollisionCount
==
nil
{
currDS
.
Status
.
CollisionCount
=
new
(
int32
)
currDS
.
Status
.
CollisionCount
=
new
(
int32
)
}
}
...
...
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