Skip to content

Commit 7399f02

Browse files
committed
fix up
Signed-off-by: wenting <wentingwu@microsoft.com>
1 parent e21a022 commit 7399f02

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

operator/src/internal/controller/physical_replication.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ func (r *DocumentDBReconciler) AddClusterReplicationToClusterSpec(
6161
// If primary and HA we want a local standby and a slot for the WAL replica
6262
// TODO change to 2 when WAL replica is available
6363
cnpgCluster.Spec.Instances = 3
64-
cnpgCluster.Spec.Bootstrap.InitDB.PostInitSQL =
65-
append(cnpgCluster.Spec.Bootstrap.InitDB.PostInitSQL,
64+
// Restoring from backup won't have PostInitSQL configured
65+
if cnpgCluster.Spec.Bootstrap != nil && cnpgCluster.Spec.Bootstrap.InitDB != nil && cnpgCluster.Spec.Bootstrap.InitDB.PostInitSQL != nil {
66+
cnpgCluster.Spec.Bootstrap.InitDB.PostInitSQL = append(
67+
cnpgCluster.Spec.Bootstrap.InitDB.PostInitSQL,
6668
"select * from pg_create_physical_replication_slot('wal_replica');")
69+
}
6770
// Also need to configure quorum writes
6871
cnpgCluster.Spec.PostgresConfiguration.Synchronous = &cnpgv1.SynchronousReplicaConfiguration{
6972
Method: cnpgv1.SynchronousReplicaConfigurationMethodAny,

operator/src/scripts/aks-fleet-deployment/documentdb-base.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ spec:
3232
version: v1
3333
kind: CustomResourceDefinition
3434
name: imagecatalogs.postgresql.cnpg.io
35+
- group: "apiextensions.k8s.io"
36+
version: v1
37+
kind: CustomResourceDefinition
38+
name: backups.postgresql.cnpg.io
3539
- group: "apiextensions.k8s.io"
3640
version: v1
3741
kind: CustomResourceDefinition

operator/src/scripts/aks-fleet-deployment/multi-region-backup.yaml renamed to operator/src/scripts/aks-fleet-deployment/multi-region-scheduledbackup.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
apiVersion: db.microsoft.com/preview
2-
kind: Backup
2+
kind: ScheduledBackup
33
metadata:
44
name: backup-test
55
namespace: documentdb-preview-ns
66
spec:
77
cluster:
88
name: documentdb-preview
9+
schedule: "* * * * *"
910

1011
---
1112
apiVersion: placement.kubernetes-fleet.io/v1beta1

0 commit comments

Comments
 (0)