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: plugin-barman-cloud #15

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ control plane node in both Kubernetes clusters, run the following commands:
kubectl cnpg install generate --control-plane | \
kubectl --context kind-k8s-eu apply -f - --server-side

kubectl --context kind-k8s-eu rollout status deployment -n cnpg-system cnpg-controller-manager

kubectl cnpg install generate --control-plane | \
kubectl --context kind-k8s-us apply -f - --server-side

kubectl --context kind-k8s-us rollout status deployment -n cnpg-system cnpg-controller-manager
```

These commands will deploy the CloudNativePG operator with server-side apply on
Expand All @@ -126,6 +130,26 @@ both the `kind-k8s-eu` and `kind-k8s-us` clusters.
Ensure that you have the latest version of the `cnpg` plugin installed on your
local machine.

## To install the barman-cloud backup plugin

Install [cert-manager](https://cert-manager.io/docs/installation/):

```bash
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.2/cert-manager.yaml

kubectl rollout status deployment -n cert-manager cert-manager
kubectl rollout status deployment -n cert-manager cert-manager-cainjector
kubectl rollout status deployment -n cert-manager cert-manager-webhook
```

Install the [barman-cloud plugin](https://github.com/cloudnative-pg/plugin-barman-cloud):

```bash
kubectl apply -f https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/heads/main/manifest.yaml

kubectl rollout status deployment -n cnpg-system barman-cloud
```

## Cleaning up the Learning Environment

When you're ready to clean up and remove all resources from the learning
Expand Down Expand Up @@ -158,3 +182,23 @@ sudo sysctl fs.inotify.max_user_instances=512
```

More information in the [relative ticket comment](https://github.com/kubernetes-sigs/kind/issues/3423#issuecomment-1872074526).

## Using Rancher Desktop

You may need to follow the instructions [in the Rancher Desktop
Guide](https://docs.rancherdesktop.io/how-to-guides/increasing-open-file-limit/)
to increase the open file limit.

```
provision:
- mode: system
script: |
#!/bin/sh
cat <<'EOF' > /etc/security/limits.d/rancher-desktop.conf
* soft nofile 82920
* hard nofile 82920
EOF
sysctl -w vm.max_map_count=262144
sysctl fs.inotify.max_user_watches=524288
sysctl fs.inotify.max_user_instances=512
```
57 changes: 18 additions & 39 deletions examples/eu/pg-eu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,11 @@ spec:
shared_memory_type: 'sysv'
dynamic_shared_memory_type: 'sysv'

backup:
barmanObjectStore:
destinationPath: s3://backups/
endpointURL: http://minio-eu:9000
s3Credentials:
accessKeyId:
name: minio-eu
key: ACCESS_KEY_ID
secretAccessKey:
name: minio-eu
key: ACCESS_SECRET_KEY
wal:
compression: gzip
plugins:
- name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: minio-eu
serverName: pg-eu

# See https://cloudnative-pg.io/documentation/current/replica_cluster/#distributed-topology
replica:
Expand All @@ -65,42 +57,29 @@ spec:

externalClusters:
- name: pg-eu
barmanObjectStore:
serverName: pg-eu
destinationPath: s3://backups/
endpointURL: http://minio-eu:9000
s3Credentials:
accessKeyId:
name: minio-eu
key: ACCESS_KEY_ID
secretAccessKey:
name: minio-eu
key: ACCESS_SECRET_KEY
wal:
compression: gzip
plugin:
name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: minio-eu
serverName: pg-eu
- name: pg-us
barmanObjectStore:
serverName: pg-us
destinationPath: s3://backups/
endpointURL: http://minio-us:9000
s3Credentials:
accessKeyId:
name: minio-us
key: ACCESS_KEY_ID
secretAccessKey:
name: minio-us
key: ACCESS_SECRET_KEY
wal:
compression: gzip
plugin:
name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: minio-us
serverName: pg-us
---
# See https://cloudnative-pg.io/documentation/current/backup/#scheduled-backups
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: pg-eu-backup
spec:
method: plugin
schedule: '0 0 0 * * *'
backupOwnerReference: self
cluster:
name: pg-eu
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
immediate: true
17 changes: 17 additions & 0 deletions examples/object-stores/minio-eu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
name: minio-eu
spec:
configuration:
destinationPath: s3://backups/
endpointURL: http://minio-eu:9000
s3Credentials:
accessKeyId:
name: minio-eu
key: ACCESS_KEY_ID
secretAccessKey:
name: minio-eu
key: ACCESS_SECRET_KEY
wal:
compression: gzip
17 changes: 17 additions & 0 deletions examples/object-stores/minio-us.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
name: minio-us
spec:
configuration:
destinationPath: s3://backups/
endpointURL: http://minio-us:9000
s3Credentials:
accessKeyId:
name: minio-us
key: ACCESS_KEY_ID
secretAccessKey:
name: minio-us
key: ACCESS_SECRET_KEY
wal:
compression: gzip
45 changes: 19 additions & 26 deletions examples/us/pg-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ spec:
shared_memory_type: 'sysv'
dynamic_shared_memory_type: 'sysv'

plugins:
- name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: minio-us
serverName: pg-us

backup:
barmanObjectStore:
destinationPath: s3://backups/
Expand All @@ -65,42 +71,29 @@ spec:

externalClusters:
- name: pg-eu
barmanObjectStore:
serverName: pg-eu
destinationPath: s3://backups/
endpointURL: http://minio-eu:9000
s3Credentials:
accessKeyId:
name: minio-eu
key: ACCESS_KEY_ID
secretAccessKey:
name: minio-eu
key: ACCESS_SECRET_KEY
wal:
compression: gzip
plugin:
name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: minio-eu
serverName: pg-eu
- name: pg-us
barmanObjectStore:
serverName: pg-us
destinationPath: s3://backups/
endpointURL: http://minio-us:9000
s3Credentials:
accessKeyId:
name: minio-us
key: ACCESS_KEY_ID
secretAccessKey:
name: minio-us
key: ACCESS_SECRET_KEY
wal:
compression: gzip
plugin:
name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: minio-us
serverName: pg-us
---
# See https://cloudnative-pg.io/documentation/current/backup/#scheduled-backups
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: pg-us-backup
spec:
method: plugin
schedule: '0 0 0 * * *'
backupOwnerReference: self
cluster:
name: pg-us
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
immediate: true