diff --git a/go.mod b/go.mod index 8b9f55509..65b6003db 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/r3labs/diff v0.0.0-20191120142937-b4ed99a31f5a github.com/sirupsen/logrus v1.5.0 github.com/stretchr/testify v1.4.0 - golang.org/x/tools v0.0.0-20200326210457-5d86d385bf88 // indirect + golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4 // indirect gopkg.in/yaml.v2 v2.2.8 k8s.io/api v0.18.0 k8s.io/apiextensions-apiserver v0.18.0 diff --git a/go.sum b/go.sum index e8607922b..d77ca6555 100644 --- a/go.sum +++ b/go.sum @@ -388,8 +388,8 @@ golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200326210457-5d86d385bf88 h1:F7fM2kxXfuWw820fa+MMCCLH6hmYe+jtLnZpwoiLK4Q= -golang.org/x/tools v0.0.0-20200326210457-5d86d385bf88/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4 h1:kDtqNkeBrZb8B+atrj50B5XLHpzXXqcCdZPP/ApQ5NY= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -431,6 +431,7 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.18.0 h1:lwYk8Vt7rsVTwjRU6pzEsa9YNhThbmbocQlKvNBB4EQ= k8s.io/api v0.18.0/go.mod h1:q2HRQkfDzHMBZL9l/y9rH63PkQl4vae0xRT+8prbrK8= diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index cef5e7e33..f655735b3 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -693,7 +693,7 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error { podIndex := strconv.Itoa(int(i)) pvcName := "pgdata-" + c.Name + "-" + podIndex - if err := c.KubeClient.PersistentVolumeClaims(c.Namespace).Delete(pvcName, c.deleteOptions); err != nil { + if err := c.KubeClient.PersistentVolumeClaims(c.Namespace).Delete(context.TODO(), pvcName, c.deleteOptions); err != nil { c.logger.Warningf("could not delete PersistentVolumeClaim: %v", err) // failing to delete pvc does not fail the update; Sync() may also delete unused PVCs later } diff --git a/pkg/cluster/sync.go b/pkg/cluster/sync.go index c5cb321e4..08c027f22 100644 --- a/pkg/cluster/sync.go +++ b/pkg/cluster/sync.go @@ -119,7 +119,7 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error { for i := c.getNumberOfInstances(&c.Spec); ; i++ { podIndex := strconv.Itoa(int(i)) pvcName := "pgdata-" + c.Name + "-" + podIndex - if err := c.KubeClient.PersistentVolumeClaims(c.Namespace).Delete(pvcName, c.deleteOptions); err != nil { + if err := c.KubeClient.PersistentVolumeClaims(c.Namespace).Delete(context.TODO(), pvcName, c.deleteOptions); err != nil { if k8sutil.ResourceNotFound(err) { // no more pvcs to delete break @@ -128,7 +128,7 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error { // next Sync() or Update() will retry } } - + } // sync connection pool if err = c.syncConnectionPool(&oldSpec, newSpec, c.installLookupFunction); err != nil { return fmt.Errorf("could not sync connection pool: %v", err)