@@ -7,7 +7,6 @@ package postgrescluster
77import  (
88	"context" 
99	"fmt" 
10- 	"strconv" 
1110
1211	"github.com/pkg/errors" 
1312	batchv1 "k8s.io/api/batch/v1" 
@@ -476,21 +475,20 @@ func (r *Reconciler) reconcileMovePGDataDir(ctx context.Context,
476475	// `patroni.dynamic.json` holds the previous state of the DCS. Since we are 
477476	// migrating the volumes, we want to clear out any obsolete configuration info. 
478477	script  :=  fmt .Sprintf (`echo "Preparing cluster %s volumes for PGO v5.x" 
479-     echo "pgdata_pvc=%s" 
480-     echo "Current PG data directory volume contents:"  
481-     ls -lh "/pgdata" 
482-     echo "Now updating PG data directory..." 
483-     [ -d "/pgdata/%s" ] && mv "/pgdata/%s" "/pgdata/pg%s_bootstrap" 
484-     rm -f "/pgdata/pg%s/patroni.dynamic.json" 
485-     echo "Updated PG data directory contents:"  
486-     ls -lh "/pgdata" 
487-     echo "PG Data directory preparation complete" 
488-     ` , cluster .Name ,
478+ echo "pgdata_pvc=%s" 
479+ echo "Current PG data directory volume contents:" 
480+ ls -lh "/pgdata" 
481+ echo "Now updating PG data directory..." 
482+ [ -d "/pgdata/%s" ] && mv "/pgdata/%s" "/pgdata/pg%d_bootstrap" 
483+ rm -f "/pgdata/pg%d/patroni.dynamic.json" 
484+ echo "Updated PG data directory contents:" 
485+ ls -lh "/pgdata" 
486+ echo "PG Data directory preparation complete"` , cluster .Name ,
489487		cluster .Spec .DataSource .Volumes .PGDataVolume .PVCName ,
490488		cluster .Spec .DataSource .Volumes .PGDataVolume .Directory ,
491489		cluster .Spec .DataSource .Volumes .PGDataVolume .Directory ,
492- 		strconv . Itoa ( cluster .Spec .PostgresVersion ) ,
493- 		strconv . Itoa ( cluster .Spec .PostgresVersion ) )
490+ 		cluster .Spec .PostgresVersion ,
491+ 		cluster .Spec .PostgresVersion )
494492
495493	container  :=  corev1.Container {
496494		Command :         []string {"bash" , "-ceu" , script },
@@ -596,15 +594,14 @@ func (r *Reconciler) reconcileMoveWALDir(ctx context.Context,
596594	moveDirJob .Labels  =  labels 
597595
598596	script  :=  fmt .Sprintf (`echo "Preparing cluster %s volumes for PGO v5.x" 
599-     echo "pg_wal_pvc=%s" 
600-     echo "Current PG WAL directory volume contents:" 
601-     ls -lh "/pgwal" 
602-     echo "Now updating PG WAL directory..." 
603-     [ -d "/pgwal/%s" ] && mv "/pgwal/%s" "/pgwal/%s-wal" 
604-     echo "Updated PG WAL directory contents:" 
605-     ls -lh "/pgwal" 
606-     echo "PG WAL directory preparation complete" 
607-     ` , cluster .Name ,
597+ echo "pg_wal_pvc=%s" 
598+ echo "Current PG WAL directory volume contents:" 
599+ ls -lh "/pgwal" 
600+ echo "Now updating PG WAL directory..." 
601+ [ -d "/pgwal/%s" ] && mv "/pgwal/%s" "/pgwal/%s-wal" 
602+ echo "Updated PG WAL directory contents:" 
603+ ls -lh "/pgwal" 
604+ echo "PG WAL directory preparation complete"` , cluster .Name ,
608605		cluster .Spec .DataSource .Volumes .PGWALVolume .PVCName ,
609606		cluster .Spec .DataSource .Volumes .PGWALVolume .Directory ,
610607		cluster .Spec .DataSource .Volumes .PGWALVolume .Directory ,
@@ -714,18 +711,17 @@ func (r *Reconciler) reconcileMoveRepoDir(ctx context.Context,
714711	moveDirJob .Labels  =  labels 
715712
716713	script  :=  fmt .Sprintf (`echo "Preparing cluster %s pgBackRest repo volume for PGO v5.x" 
717-     echo "repo_pvc=%s" 
718-     echo "pgbackrest directory:" 
719-     ls -lh /pgbackrest 
720-     echo "Current pgBackRest repo directory volume contents:"  
721-     ls -lh "/pgbackrest/%s" 
722-     echo "Now updating repo directory..." 
723-     [ -d "/pgbackrest/%s" ] && mv -t "/pgbackrest/" "/pgbackrest/%s/archive" 
724-     [ -d "/pgbackrest/%s" ] && mv -t "/pgbackrest/" "/pgbackrest/%s/backup" 
725-     echo "Updated /pgbackrest directory contents:" 
726-     ls -lh "/pgbackrest" 
727-     echo "Repo directory preparation complete" 
728-     ` , cluster .Name ,
714+ echo "repo_pvc=%s" 
715+ echo "pgbackrest directory:" 
716+ ls -lh /pgbackrest 
717+ echo "Current pgBackRest repo directory volume contents:" 
718+ ls -lh "/pgbackrest/%s" 
719+ echo "Now updating repo directory..." 
720+ [ -d "/pgbackrest/%s" ] && mv -t "/pgbackrest/" "/pgbackrest/%s/archive" 
721+ [ -d "/pgbackrest/%s" ] && mv -t "/pgbackrest/" "/pgbackrest/%s/backup" 
722+ echo "Updated /pgbackrest directory contents:" 
723+ ls -lh "/pgbackrest" 
724+ echo "Repo directory preparation complete"` , cluster .Name ,
729725		cluster .Spec .DataSource .Volumes .PGBackRestVolume .PVCName ,
730726		cluster .Spec .DataSource .Volumes .PGBackRestVolume .Directory ,
731727		cluster .Spec .DataSource .Volumes .PGBackRestVolume .Directory ,
0 commit comments