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

Create pgbackrest example configuration for GCS #22

Merged
merged 1 commit into from
Aug 9, 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
29 changes: 29 additions & 0 deletions cluster-tutorials/pgbackrest_with_gcs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# pgbackrest with GCS

## Creating the key.json file

The key.json file should be created on an appropriate GCP IAM service account with at least the minimum permissions for
GCS to read/write to your bucket. Once the keyfile is downloaded, it should be created as a secret within kubernetes using
either the appropriate ci/cd pipelines (leveraging an engine like Vault), or via:

```
kubectl create secret generic gcs-credentials --from-file=/path/to/key.json
```

## Method 1: operator configuration

The operator needs the following configuration enabled to mount the gcs-credentials secret in all postgres containers:

```
configuration:
aws_or_gcp:
additional_secret_mount: gcs-credentials
additional_secret_mount_path: /var/secrets/google
gcp_credentials: /var/secrets/google/key.json
```

## Method 2: per-cluster configuration

Alternatively you could utilize additionalVolumes in postgres.yaml to mount cluster-specific secrets in the postgresql cluster,
but if you change the name or the path that the keyfile is mounted to, you need to update spec.backup.pgbackrest.global.repo1-gcs-key
in postgres.yaml to match.
35 changes: 35 additions & 0 deletions cluster-tutorials/pgbackrest_with_gcs/postgres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: cpo.opensource.cybertec.at/v1
kind: postgresql
metadata:
name: cluster-1
spec:
dockerImage: 'docker.io/cybertecpostgresql/cybertec-pg-container:postgres-16.3-1'
numberOfInstances: 1
postgresql:
version: '16'
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 500m
memory: 500Mi
teamId: acid
volume:
size: 5Gi
backup:
pgbackrest:
global:
repo1-gcs-key: /var/secrets/google/key.json
repo1-gcs-key-type: service
repo1-path: /YOUR_PATH_INSIDE_THE_BUCKET/repo1/
repo1-retention-full: '7'
repo1-retention-full-type: count
image: docker.io/cybertecpostgresql/cybertec-pg-container:pgbackrest-16.3-1
repos:
- endpoint: YOUR_GCS_ENDPOINT
name: repo1
resource: YOUR_BUCKET_NAME
schedule:
full: 30 2 * * *
storage: gcs
2 changes: 1 addition & 1 deletion setup/helm/operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ imagePullSecretNames: []

# Define the operator settings to add to the configmap
operatorSettings:
operatorImage: 'docker.io/cybertecpostgresql/cybertec-pg-operator:v0.7.0-1'
operatorImage: 'docker.io/cybertecpostgresql/cybertec-pg-operator-dev:v0.7.0-2'
postgresImage: 'docker.io/cybertecpostgresql/cybertec-pg-container:postgres-16.3-1'
poolerImage: 'docker.io/cybertecpostgresql/cybertec-pg-container:pgbouncer-1.22-1'
watched_namespace: '*'
Expand Down