Skip to content

Commit

Permalink
Enable postgres backups in dev (for testing)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimCsaky committed Oct 18, 2024
1 parent 95e95c3 commit 4785e3f
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 11 deletions.
58 changes: 58 additions & 0 deletions .github/environments/values.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,61 @@ postgres:
limits:
cpu: 100m
memory: 512Mi

# -------- backups ---------
pgBackRestConfig:
# allow one-off backups
manual:
repoName: repo1
options:
- --type=full
configuration:
# secret for saving backups to S3
- secret:
name: pgbackrest-s3
global:
# log-level-console: debug
# --- pvc
repo1-retention-full: "3"
repo1-retention-diff: "12"
# --- s3
repo2-path: /backups/common-object-management-service/postgres/dev
repo2-retention-full: "30"
repo2-s3-uri-style: path
repos:
- name: repo1
schedules:
full: "0 7 * * *" # full backup every day at 7am
differential: "0 */2 * * *" # differential every 2 hours
volume:
volumeClaimSpec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: 2Gi
storageClassName: "netapp-file-backup"
- name: repo2
schedules:
full: "*/10 * * *" # full backup every 10 minutes
s3:
bucket: csstops
endpoint: https://nrs.objectstore.gov.bc.ca
region: us-east-1
repoHost:
resources:
requests:
cpu: 1m
memory: 64Mi
limits:
cpu: 50m
memory: 128Mi
sidecars:
pgbackrest:
resources:
requests:
cpu: 1m
memory: 64Mi
limits:
cpu: 50m
memory: 128Mi
4 changes: 2 additions & 2 deletions charts/coms/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: common-object-management-service
# 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.1.4
version: 1.1.0
kubeVersion: ">= 1.13.0"
description: A microservice for managing access control to S3 Objects
# A chart can be either an 'application' or a 'library' chart.
Expand All @@ -28,7 +28,7 @@ sources:
- https://github.com/bcgov/common-object-management-service
dependencies:
- name: postgrescluster
version: 0.1.4
version: 1.1.0
repository: "file://../postgres"
condition: postgres.enabled
alias: postgres
Expand Down
4 changes: 0 additions & 4 deletions charts/coms/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,3 @@ postgres:
limits:
cpu: 50m
memory: 128Mi

# -------- backups ---------
pgBackRestConfig:
repos: {}
2 changes: 1 addition & 1 deletion charts/postgres/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name: postgrescluster
description: A Helm chart for Kubernetes
type: application
# The version below should match the version on the PostgresCluster CRD
version: 0.1.4
version: 1.1.0
appVersion: 5.6.0
4 changes: 0 additions & 4 deletions charts/postgres/templates/pgbackrest-s3-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

{{- range $index, $repo := .Values.pgBackRestConfig.repos }}
{{- if $repo.s3 }}
{{- $secretExists := (lookup "v1" "Secret" $.Release.Namespace "pgbackrest-s3" ) }}
{{- if not $secretExists }}
# this secret allows crunchyDb (pgbackrest) to connect to an S3 host for saving backups.
Expand All @@ -18,5 +16,3 @@ stringData:
repo2-s3-key=<s3 access key id>
repo2-s3-key-secret=<s3 secret access key>
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 4785e3f

Please sign in to comment.