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: add ability to restore from s3 data source #55

Merged
merged 2 commits into from
Jun 10, 2024
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
2 changes: 1 addition & 1 deletion charts/crunchy-postgres/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.6.2
version: 0.6.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
17 changes: 17 additions & 0 deletions charts/crunchy-postgres/templates/PostgresCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,23 @@ spec:
- name: postgres
databases:
- {{ template "crunchy-postgres.fullname" . }}

{{ if .Values.dataSource.enabled }}
dataSource:
pgbackrest:
configuration:
- secret:
name: {{ .Values.dataSource.secretName }}
global:
repo2-path: {{ .Values.dataSource.repo.path }}
repo:
name: {{ .Values.dataSource.repo.name }}
s3:
bucket: {{ .Values.dataSource.repo.s3.bucket }}
endpoint: {{ .Values.dataSource.repo.s3.endpoint }}
region: {{ .Values.dataSource.repo.s3.region }}
stanza: {{ .Values.dataSource.stanza }}
{{ end }}

backups:
pgbackrest:
Expand Down
17 changes: 16 additions & 1 deletion charts/crunchy-postgres/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ instances:
cpu: 50m
memory: 64Mi

# If we need to restore the cluster from a backup, we need to set the following values
# assuming restore from repo2 (s3), adjust as needed if your S3 repo is different
dataSource:
enabled: false
# should have the same name and contain the same keys as the pgbackrest secret
secretName: s3-pgbackrest
repo:
name: repo2
path: "/habackup"
s3:
bucket: "bucketName"
endpoint: "s3.ca-central-1.amazonaws.com"
region: "ca-central-1"
stanza: db

pgBackRest:
image: # it's not necessary to specify an image as the images specified in the Crunchy Postgres Operator will be pulled by default
retention: "2" # Ideally a larger number such as 30 backups/days
Expand Down Expand Up @@ -63,7 +78,7 @@ pgBackRest:
s3:
enabled: false
createS3Secret: true
# the s3 secret name
# the s3 secret name
s3Secret: s3-pgbackrest
# the path start with /, it will be created under bucket if it doesn't exist
s3Path: "/habackup"
Expand Down
Loading