Open
Labels
enhancementNew feature or requestNew feature or request
Description
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
Reacted by Dmytro Alieksieiev, Alex Lebens, akirilltikhonov and Loris
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
dosubot commentedon Oct 19, 2025
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
barmanObjectNameset in the Cluster's plugin section. Any parameters likebarmanObjectNamein 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.
dragoangel commentedon Oct 19, 2025
@flx5 I also want to extend this part if you not mind -
retentionPolicyof "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 toretentionPolicytime.So if I need 30 days of backups, I have to choose one of:
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.:1yildar-fix commentedon Aug 26, 2026
We ran into this as well, and it is still the behaviour on
main(v0.14.0+12):BackupServiceImplementation.Backupbuilds its configuration with
config.NewFromClusterJSON(request.ClusterDefinition)and never looks atrequest.Parameters, although the operator does relayBackup.spec.pluginConfiguration.parametersin theBackupRequest(pkg/management/postgres/webserver/plugin_backup.go->internal/cnpi/plugin/client/backup.go).The backup ends up
completedwith no warning, so the only symptom is an archive that stays empty.We have a fix running on a test stand (CNPG 1.30.0, S3): a
Backupcarryingparameters.barmanObjectName: archive-storelands in that store, WALs keep going to the cluster store, and acluster bootstrapped from that pair comes up with all the data.
Before sending a PR we would like your opinion on two points.
1. RBAC. Honouring the parameter is not enough on its own. The
Rolebound to the instance service account isbuilt from the object stores the
Clusterrefers to (rbac.EnsureRole<-GetReferredBarmanObjectsKey), so aBackupnaming any other store fails withobjectstores.barmancloud.cnpg.io "archive-store" is forbidden. We solved it with a cluster level pluginparameter,
additionalBarmanObjectNames: a comma separated list of stores that take part in the RBAC and in thecertificates of the instances, while nothing is routed to them. It is declarative and explicit, but it does add
API surface. If you would rather widen the Role some other way, we are happy to follow that instead.
2. Scope. Would you take the fix on its own, or do you want per backup object store selection designed more
broadly, together with @dragoangel's point about the retention of the second store? Separately, and not part of
this proposal, we also have a working implementation of keeping base backups and WALs in two different object
stores (a
baseBackupBarmanObjectNameparameter and the matching recovery path). That is what brought us here:our provider sets the storage class per bucket, and base backups and WALs have opposite optimal classes. We can
open a separate issue for it if there is any appetite.
The branch is ready against
main, with unit tests in the existing Ginkgo suite. We will send it as soon as youtell us which shape you prefer.