Use CollisionCount for collision avoidance in StatefulSet controller

This commit is contained in:
Yinan Li
2017-08-18 06:49:02 -07:00
parent afabd09889
commit 46c6aea1cf
6 changed files with 193 additions and 116 deletions

View File

@@ -288,7 +288,7 @@ func getPatch(set *apps.StatefulSet) ([]byte, error) {
// The Revision of the returned ControllerRevision is set to revision. If the returned error is nil, the returned
// ControllerRevision is valid. StatefulSet revisions are stored as patches that re-apply the current state of set
// to a new StatefulSet using a strategic merge patch to replace the saved state of the new StatefulSet.
func newRevision(set *apps.StatefulSet, revision int64) (*apps.ControllerRevision, error) {
func newRevision(set *apps.StatefulSet, revision int64, collisionCount *int32) (*apps.ControllerRevision, error) {
patch, err := getPatch(set)
if err != nil {
return nil, err
@@ -301,7 +301,8 @@ func newRevision(set *apps.StatefulSet, revision int64) (*apps.ControllerRevisio
controllerKind,
selector,
runtime.RawExtension{Raw: patch},
revision)
revision,
collisionCount)
if err != nil {
return nil, err
}