Skip to content

Commit 363c690

Browse files
author
jmccormick2001
committed
fix backrest restore to use the pgcluster primary storage for the restored pvc instead of the default primary storage config
1 parent 836e463 commit 363c690

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

operator/backrest/restore.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,13 @@ func Restore(restclient *rest.RESTClient, namespace string, clientset *kubernete
8383
}
8484

8585
//use the storage config from pgo.yaml for Primary
86-
storage := operator.Pgo.Storage[operator.Pgo.PrimaryStorage]
86+
//use the storage config from the pgcluster for the restored pvc
87+
//storage := operator.Pgo.Storage[operator.Pgo.PrimaryStorage]
88+
storage := cluster.Spec.PrimaryStorage
8789

8890
//create the "to-cluster" PVC to hold the new data
8991
var pvcName string
90-
pvcName, err = createPVC(clusterName, restclient, namespace, clientset, task)
92+
pvcName, err = createPVC(storage, clusterName, restclient, namespace, clientset, task)
9193
if err != nil {
9294
log.Error(err)
9395
return
@@ -247,14 +249,13 @@ func updateWorkflow(restclient *rest.RESTClient, workflowID, namespace, status s
247249
return err
248250
}
249251

250-
func createPVC(clusterName string, restclient *rest.RESTClient, namespace string, clientset *kubernetes.Clientset, task *crv1.Pgtask) (string, error) {
252+
func createPVC(storage crv1.PgStorageSpec, clusterName string, restclient *rest.RESTClient, namespace string, clientset *kubernetes.Clientset, task *crv1.Pgtask) (string, error) {
251253
var err error
252254

253-
//use the storage config from pgo.yaml for Primary
254-
storage := operator.Pgo.Storage[operator.Pgo.PrimaryStorage]
255-
256255
//create the "to-cluster" PVC to hold the new data
257256
pvcName := task.Spec.Parameters[util.LABEL_BACKREST_RESTORE_TO_PVC]
257+
pgstoragespec := storage
258+
/**
258259
pgstoragespec := crv1.PgStorageSpec{}
259260
pgstoragespec.AccessMode = storage.AccessMode
260261
pgstoragespec.Size = storage.Size
@@ -263,6 +264,7 @@ func createPVC(clusterName string, restclient *rest.RESTClient, namespace string
263264
pgstoragespec.Fsgroup = storage.Fsgroup
264265
pgstoragespec.SupplementalGroups = storage.SupplementalGroups
265266
pgstoragespec.MatchLabels = storage.MatchLabels
267+
*/
266268

267269
var found bool
268270
_, found, err = kubeapi.GetPVC(clientset, pvcName, namespace)

0 commit comments

Comments
 (0)