plugin-barman-cloud icon indicating copy to clipboard operation
plugin-barman-cloud copied to clipboard

Backup to different object store

Open flx5 opened this issue 1 year ago • 2 comments

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
  

flx5 avatar Oct 19 '25 19:10 flx5

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.

Leave Feedback Learn about plugin-barman-cloud with Dosu Add Dosu to your team

dosubot[bot] avatar Oct 19 '25 19:10 dosubot[bot]

@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:

  1. create custom sync jobs that would "copy" my daily backups to another storage for older time and manage their expiration on my own
  2. 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:

  1. isWALArchiver enabled just on current primary cluster, now it ignored AFAIK
  2. retentionPolicy defined in barmanObjectName which writes WAL is set window I want to get PITR from, f.e.: 2d or 7d
  3. scheduledBackup runs daily and refers another barmanObjectName which has own retentionPolicy which is to to window for which I expect have "daily full backups" in place, f.e.: 30d
  4. scheduledBackup runs monthly and refers another barmanObjectName which has own retentionPolicy for which I expect have "montly full backups" in palce, f.e.: 1y

dragoangel avatar Oct 19 '25 21:10 dragoangel