Backup to different object store
Hi, first of all thank you for the amazing work!
I might have a bit of an odd use case: Currently I have two S3 compatible object stores. One onsite and one for offsite backups. Because the connection to the offsite one can be quite slow (this is a homelab setup), I didn't want to send WALs to the offsite S3 but just baseline backups every so often.
From what I can tell the BackupServiceImplementation currently just uses the barmanObjectKey from the cluster definition and ignores any parameters specified directly on the Backup or BackupSchedule CRD.
Would it be possible to support overriding the object store in the backup crd like this?
apiVersion: postgresql.cnpg.io/v1
kind: Backup
metadata:
name: backup-example
spec:
cluster:
name: pg-nextcloud
method: plugin
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: anotherObjectStore
Hi @flx5! I'm Dosu and I’m helping the plugin-barman-cloud team.
You're correct—right now, CloudNativePG and the barman-cloud plugin do not support overriding the object store per backup using parameters in the Backup CRD. The object store is always selected based on the cluster-level configuration, specifically the barmanObjectName set in the Cluster's plugin section. Any parameters like barmanObjectName in the Backup or ScheduledBackup CRD are ignored by the backup execution logic, so per-backup object store selection isn't possible at this time [docs].
If you need to send only base backups to your offsite store, the only workaround is to temporarily change the cluster's plugin configuration to point to the offsite object store before triggering a backup, then switch it back for regular operations. This approach has risks (like potential WAL archiving disruption during the switch), so use with caution.
There are no existing discussions or issues about supporting this feature, but your use case is valid and could be a good candidate for a future enhancement.
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
@flx5 I also want to extend this part if you not mind - retentionPolicy of "another" barman CR should be also honored. What for me is an issue: barman from what I read in recovery window docs - stores both full WAL & backups up to retentionPolicy time.
So if I need 30 days of backups, I have to choose one of:
- create custom sync jobs that would "copy" my daily backups to another storage for older time and manage their expiration on my own
- delete WAL archives for days I not interested in manually from S3
Both variants sounds like wrong things to do, idealy it should be possible via:
isWALArchiverenabled just on current primary cluster, now it ignored AFAIKretentionPolicydefined inbarmanObjectNamewhich writesWALis set window I want to get PITR from, f.e.:2dor7dscheduledBackupruns daily and refers anotherbarmanObjectNamewhich has ownretentionPolicywhich is to to window for which I expect have "daily full backups" in place, f.e.:30dscheduledBackupruns monthly and refers anotherbarmanObjectNamewhich has ownretentionPolicyfor which I expect have "montly full backups" in palce, f.e.:1y