Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow simple pg_basebackup #35

Merged
merged 3 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions charts/cnpg-cluster/templates/cluster.cnpg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ spec:
recoveryTarget:
targetTime: "{{ .Values.recovery.targetTime }}"
{{- end }}
{{- else if (and .Values.replica.enabled .Values.replica.source) }}
{{- else if (and .Values.pg_basebackup.enabled .Values.pg_basebackup.source) }}
pg_basebackup:
source: {{ .Values.replica.source }}
source: {{ .Values.pg_basebackup.source }}
{{- else }}
initdb:
database: {{ .Values.dbName }}
Expand Down
13 changes: 13 additions & 0 deletions charts/cnpg-cluster/tests/__snapshot__/cnpg-cluster_test.yaml.snap
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ cluster with enabled backup and recovery:
cluster:
name: RELEASE-NAME-cnpg-cluster
schedule: 1 2 3 * * 0
cluster with pg_basebackup:
1: |
- connectionParameters:
dbname: app
host: some-host-to-replicate-from
user: postgres
name: source-cluster
password:
key: password
name: source-secret-for-source-replication
2: |
pg_basebackup:
source: source-cluster
cluster with recovery enabled:
1: |
bootstrap:
Expand Down
10 changes: 10 additions & 0 deletions charts/cnpg-cluster/tests/cnpg-cluster_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,13 @@ tests:
- template: cluster.cnpg.yaml
matchSnapshot:
path: spec.replica
- it: cluster with pg_basebackup
values:
- ./values/pg_basebackup.yaml
asserts:
- template: cluster.cnpg.yaml
matchSnapshot:
path: spec.externalClusters
- template: cluster.cnpg.yaml
matchSnapshot:
path: spec.bootstrap
13 changes: 13 additions & 0 deletions charts/cnpg-cluster/tests/values/pg_basebackup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pg_basebackup:
enabled: true
source: source-cluster

externalClusters:
- name: source-cluster
connectionParameters:
host: some-host-to-replicate-from
user: postgres
dbname: app
password:
name: source-secret-for-source-replication
key: password
6 changes: 4 additions & 2 deletions charts/cnpg-cluster/tests/values/replication.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
imageName: ghcr.io/cloudnative-pg/postgis:14

replica:
enabled: true
source: source-cluster

pg_basebackup:
enabled: true
source: source-cluster

externalClusters:
- name: source-cluster
connectionParameters:
Expand Down
5 changes: 5 additions & 0 deletions charts/cnpg-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,8 @@ postInitApplicationSQLRefs:
# secretRefs:
# - name: post-init-sql-secret
# key: secret.sql

#
pg_basebackup:
enabled: false
source:
Loading