controllers: simplify deepcopy calls

This commit is contained in:
Dr. Stefan Schimanski
2017-08-15 14:14:21 +02:00
parent 28f6b3fcc0
commit 1d053c4f7c
50 changed files with 86 additions and 475 deletions

View File

@@ -332,11 +332,7 @@ func newRevision(set *apps.StatefulSet, revision int64, collisionCount *int32) (
// ApplyRevision returns a new StatefulSet constructed by restoring the state in revision to set. If the returned error
// is nil, the returned StatefulSet is valid.
func ApplyRevision(set *apps.StatefulSet, revision *apps.ControllerRevision) (*apps.StatefulSet, error) {
obj, err := scheme.Scheme.DeepCopy(set)
if err != nil {
return nil, err
}
clone := obj.(*apps.StatefulSet)
clone := set.DeepCopy()
patched, err := strategicpatch.StrategicMergePatch([]byte(runtime.EncodeOrDie(patchCodec, clone)), revision.Data.Raw, clone)
if err != nil {
return nil, err