Support traditional retention policies
Currently, I can only find a way to retain a single date range of backups. (pointers to the contrary welcome!)
In a production deployment, our business quite often requires something like 1 year or longer retention, but keeping 1 (or 7) years of daily FULL backups would be quite cost prohibitive!
Please consider adding support for a more traditional retention policy like:
"7 days, 4 weeks, 12 months, 7 years"
Additionally, this plays well with the new incremental backup features available in Pg17!
Suggestion:
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: hourly-backup
spec:
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
parameters:
retentionPolicy: 1d
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: daily-backup
spec:
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
parameters:
retentionPolicy: 14d
Same goes for backups:
apiVersion: postgresql.cnpg.io/v1
kind: Backup
metadata:
name: on-demand-backup
spec:
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
parameters:
retentionPolicy: 14d
Hi Barman Cloud plugin maintainers,
I would like to ask if there is any plan on the horizon to implement this feature? For us, and I think for most of the prod teams, this feature would be very beneficial and crucial, as it is a very common scenario to have different retention policies for daily, weekly, monthly, and so on backups.
Moreover, as far I can see (and @geekmush also mentioned it), there is no even temporal workaround for "traditional rentention policies" because CNPG + Barman are designed to always have 1 ObjectStore per cluster, all parameters like retention policies and tags are set up on ObjectStore level, and, thus, they will be applied for all backups (daily, weekly, monthly), which makes usage of several ScheduledBackup a bit worthless: if I have daily backup, there is no sense to have weekly.
Some related issues:
- https://github.com/cloudnative-pg/plugin-barman-cloud/issues/611
- https://github.com/cloudnative-pg/cloudnative-pg/issues/8757#issuecomment-3371578057
- https://github.com/cloudnative-pg/cloudnative-pg/discussions/10349#discussioncomment-16231779
P.S. I also add that it would be useful to set up not only renentionPolicy, but also tags on ScheduledBackup level, because it allows managing lifecycle rules on the storage level (for example, for moving backup files in S3 from STANDARD to DEEP_ACRHIVE storage class after N days). Something like:
kind: ScheduledBackup
metadata:
name: daily-backup
spec:
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
parameters:
retentionPolicy: 14d
tags:
type: "daily"