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

@@ -38,7 +38,6 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/controller"
"k8s.io/kubernetes/pkg/controller/history"
@@ -451,11 +450,7 @@ func (ssc *StatefulSetController) sync(key string) error {
func (ssc *StatefulSetController) syncStatefulSet(set *apps.StatefulSet, pods []*v1.Pod) error {
glog.V(4).Infof("Syncing StatefulSet %v/%v with %d pods", set.Namespace, set.Name, len(pods))
// TODO: investigate where we mutate the set during the update as it is not obvious.
setCopy, err := api.Scheme.DeepCopy(set)
if err != nil {
return err
}
if err := ssc.control.UpdateStatefulSet(setCopy.(*apps.StatefulSet), pods); err != nil {
if err := ssc.control.UpdateStatefulSet(set.DeepCopy(), pods); err != nil {
return err
}
glog.V(4).Infof("Successfully synced StatefulSet %s/%s successful", set.Namespace, set.Name)