mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-06 17:01:39 +02:00
adjust API calls to use context
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user