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

Unable to cluster:/spec/bootstrap/recovery/backup when backup is a plugin-barman-cloud

Open pvbiesen opened this issue 1 year ago • 4 comments

cnpg version 1.27 plugin-barman-cloud v0.6.0

Given a backup

apiVersion: postgresql.cnpg.io/v1
kind: Backup
metadata:
  labels:
    cnpg.io/cluster: db1
  name: db1-20250903144632
  namespace: db-staging
spec:
  cluster:
    name: db1
  method: plugin
  pluginConfiguration:
    name: barman-cloud.cloudnative-pg.io

I want to bootstrap a cluster

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: db2
  namespace: db-staging
spec:
  backup:
    volumeSnapshot:
      className: nodebound-storage-snapclass
  bootstrap:
    recovery:
      backup:
        name: db1-20250903144632
  [...]

I get errors

{
"level":"error",
"ts":"2025-09-04T08:22:02.392371161Z",
"msg":"restore error",
"logging_pod":"db2-1-full-recovery",
"error":"while restoring cluster: missing Azure credentials",
"stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\tpkg/mod/github.com/cloudnative-pg/[email protected]/pkg/log/log.go:125\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/instance/restore.NewCmd.func1\n\tinternal/cmd/manager/instance/restore/cmd.go:101\ngithub.com/spf13/cobra.(*Command).execute\n\tpkg/mod/github.com/spf13/[email protected]/command.go:1015\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tpkg/mod/github.com/spf13/[email protected]/command.go:1148\ngithub.com/spf13/cobra.(*Command).Execute\n\tpkg/mod/github.com/spf13/[email protected]/command.go:1071\nmain.main\n\tcmd/manager/main.go:71\nruntime.main\n\t/opt/hostedtoolcache/go/1.24.6/x64/src/runtime/proc.go:283"
}
  • The backup manifest does not contain a reference to the ObjectStore.
  • Adding a /spec/plugins section to the Cluster does not work
  • Adding an externalClusters entry does not work as the bootstrap-recovery-backup spec only allows name

Is there a way to use an existing Backup object to bootstrap a Cluster ?

pvbiesen avatar Sep 04 '25 08:09 pvbiesen

Hi @pvbiesen! I'm Dosu and I’m helping the plugin-barman-cloud team.

Restoring a cluster from a plugin-barman-cloud backup requires using the externalClusters section with the correct plugin and object store credentials. Referencing the backup by name in .spec.bootstrap.recovery.backup.name is not sufficient for plugin-based backups, because it does not provide the necessary object store configuration or credentials, which leads to errors like "missing Azure credentials" during restore.

The supported method is to use .spec.bootstrap.recovery.source and define an externalClusters entry with the plugin name, parameters (such as barmanObjectName and serverName), and credentials for the object store. This is documented as the required approach for plugin-barman-cloud restores, and there are no documented workarounds for using .spec.bootstrap.recovery.backup.name with plugin-based backups. The backup manifest itself does not contain object store references; these must be supplied in the Cluster spec via externalClusters for the restore to succeed. Adding /spec/plugins only enables WAL archiving for the running cluster and does not affect restore operations reference.

To resolve your issue, switch to the documented restore workflow using .spec.bootstrap.recovery.source and configure externalClusters with the required plugin and credentials reference.

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about plugin-barman-cloud Share Dosu with your team

dosubot[bot] avatar Sep 04 '25 08:09 dosubot[bot]

Ok, so the answer is 'no'.

I was just wondering now if .spec.bootstrap.recovery.backup was going to be deprecated or fixed.

pvbiesen avatar Sep 04 '25 08:09 pvbiesen

There's no indication in the official documentation or recent release notes that .spec.bootstrap.recovery.backup is going to be deprecated or fixed to support plugin-based backups. It remains a supported method for restoring from Backup objects in non-plugin scenarios, but for plugin-barman-cloud restores, the documented and supported workflow is still to use .spec.bootstrap.recovery.source with externalClusters for credentials and configuration reference.

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about plugin-barman-cloud Share Dosu with your team

dosubot[bot] avatar Sep 04 '25 08:09 dosubot[bot]

Seeing as the issue seems to be more rooted in CNPG's CRs (not the plugin's ones), a link to an issue with the same problems: https://github.com/cloudnative-pg/plugin-barman-cloud/issues/510

siegenthalerroger avatar Sep 04 '25 13:09 siegenthalerroger