From 3b6454c2dcdf8ee1097192229094d9302389af3a Mon Sep 17 00:00:00 2001 From: Murat Kabilov Date: Wed, 17 May 2017 11:54:50 +0200 Subject: [PATCH] add missed return (#20) --- pkg/cluster/cluster.go | 1 - pkg/cluster/resources.go | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 5211d6458..18fe68b29 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -267,7 +267,6 @@ func (c *Cluster) sameVolumeWith(volume spec.Volume) (match bool, reason string) return } - func (c *Cluster) compareStatefulSetWith(statefulSet *v1beta1.StatefulSet) (match, needsReplace, needsRollUpdate bool, reason string) { match = true //TODO: improve me diff --git a/pkg/cluster/resources.go b/pkg/cluster/resources.go index 31a07dde6..7166c7f23 100644 --- a/pkg/cluster/resources.go +++ b/pkg/cluster/resources.go @@ -7,11 +7,11 @@ import ( "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/apis/apps/v1beta1" - "github.com/zalando-incubator/postgres-operator/pkg/util/retryutil" "github.com/zalando-incubator/postgres-operator/pkg/spec" "github.com/zalando-incubator/postgres-operator/pkg/util" "github.com/zalando-incubator/postgres-operator/pkg/util/constants" "github.com/zalando-incubator/postgres-operator/pkg/util/k8sutil" + "github.com/zalando-incubator/postgres-operator/pkg/util/retryutil" ) func (c *Cluster) loadResources() error { @@ -174,10 +174,11 @@ func (c *Cluster) replaceStatefulSet(newStatefulSet *v1beta1.StatefulSet) error err := retryutil.Retry(constants.StatefulsetDeletionInterval, constants.StatefulsetDeletionTimeout, func() (bool, error) { _, err := c.KubeClient.StatefulSets(oldStatefulset.Namespace).Get(oldStatefulset.Name) + return err != nil, nil }) if err != nil { - fmt.Errorf("could not delete statefulset: %s", err) + return fmt.Errorf("could not delete statefulset: %s", err) } // create the new statefulset with the desired spec. It would take over the remaining pods. @@ -191,9 +192,9 @@ func (c *Cluster) replaceStatefulSet(newStatefulSet *v1beta1.StatefulSet) error c.logger.Warnf("Number of pods for the old and updated Statefulsets is not identical") } } + c.Statefulset = createdStatefulset return nil - } func (c *Cluster) deleteStatefulSet() error {