cloudnative-pg / cloudnative-pg/plugin-barman-cloud

plugin-barman-cloud does not work with r2 S3 compatible storage.

オープン
#411 コメント 17 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Go
スター
191
フォーク
72
平均マージ
2日 21時間
マージ済み PR(30日)
21

説明

Hello,

I've had an issue with using plugin-barman-cloud with r2 provider from Cloudflare. Whilst the backups seem to create propertly, it seems not possible to restore.

I assume that this is an r2 issue, as the logs reference an rpc exception, but I am happy to do more to debug this if people can help me with additional steps. I attach the R2 compatibility matrix for S3 below:

https://developers.cloudflare.com/r2/api/s3/api/

```
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: y-psql
namespace: default
spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgis:16
bootstrap:
recovery:
source: clusterBackup
plugins:
- name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: r2-store
externalClusters:
- name: clusterBackup
plugin:
name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: r2-store-live
serverName: y-psql
monitoring:
enablePodMonitor: true
storage:
pvcTemplate:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
name: r2-store
spec:
configuration:
destinationPath: "s3://pg-backup/dev-y-psql"
endpointURL: "https://uniqueid.r2.cloudflarestorage.com"
s3Credentials:
accessKeyId:
name: r2
key: AccessKey
secretAccessKey:
name: r2
key: SecretKey
wal:
compression: gzip
```

```
Defaulted container "full-recovery" out of: full-recovery, bootstrap-controller (init), plugin-barman-cloud (init)
{"level":"info","ts":"2025-06-20T12:31:12.738563178Z","msg":"Starting webserver","logging_pod":"y-psql-1-full-recovery","address":"localhost:8010","hasTLS":false}
{"level":"info","ts":"2025-06-20T12:31:12.839569885Z","msg":"Restore through plugin detected, proceeding...","logging_pod":"y-psql-1-full-recovery"}
{"level":"error","ts":"2025-06-20T12:31:15.194986191Z","msg":"Error while restoring a backup","logging_pod":"y-psql-1-full-recovery","error":"rpc error: code = Unknown desc = unexpected failure invoking barman-cloud-wal-archive: exit status 1","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\tpkg/mod/github.com/cloudnative-pg/machinery@v0.2.0/pkg/log/log.go:125\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/instance/restore.restoreSubCommand\n\tinternal/cmd/manager/instance/restore/restore.go:79\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/instance/restore.(*restoreRunnable).Start\n\tinternal/cmd/manager/instance/restore/restore.go:62\nsigs.k8s.io/controller-runtime/pkg/manager.(*runnableGroup).reconcile.func1\n\tpkg/mod/sigs.k8s.io/controller-runtime@v0.20.4/pkg/manager/runnable_group.go:226"}
{"level":"info","ts":"2025-06-20T12:31:15.19525982Z","msg":"Stopping and waiting for non leader election runnables"}
{"level":"info","ts":"2025-06-20T12:31:15.195285188Z","msg":"Stopping and waiting for leader election runnables"}
{"level":"info","ts":"2025-06-20T12:31:15.195420772Z","msg":"Webserver exited","logging_pod":"y-psql-1-full-recovery","address":"localhost:8010"}
{"level":"info","ts":"2025-06-20T12:31:15.195433711Z","msg":"Stopping and waiting for caches"}
{"level":"info","ts":"2025-06-20T12:31:15.195665953Z","msg":"pkg/mod/k8s.io/client-go@v0.32.3/tools/cache/reflector.go:251: watch of *v1.Cluster ended with: an error on the server (\"unable to decode an event from the watch stream: context canceled\") has prevented the request from succeeding"}
{"level":"info","ts":"2025-06-20T12:31:15.195859656Z","msg":"Stopping and waiting for webhooks"}
{"level":"info","ts":"2025-06-20T12:31:15.195880376Z","msg":"Stopping and waiting for HTTP servers"}
{"level":"info","ts":"2025-06-20T12:31:15.196018661Z","msg":"Wait completed, proceeding to shutdown the manager"}
{"level":"error","ts":"2025-06-20T12:31:15.196045833Z","msg":"restore error","logging_pod":"y-psql-1-full-recovery","error":"while restoring cluster: rpc error: code = Unknown desc = unexpected failure invoking barman-cloud-wal-archive: exit status 1","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\tpkg/mod/github.com/cloudnative-pg/machinery@v0.2.0/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/cobra@v1.9.1/command.go:1015\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tpkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1148\ngithub.com/spf13/cobra.(*Command).Execute\n\tpkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1071\nmain.main\n\tcmd/manager/main.go:71\nruntime.main\n\t/opt/hostedtoolcache/go/1.24.3/x64/src/runtime/proc.go:283"}
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

提供された R2 ObjectStore 設定と Cloudflare の S3 互換性マトリックスから始めます。internal/cmd/manager/instance/restore/restore.go と cmd.go を通じて barman-cloud-wal-archive の呼び出しを追跡し、その後 restore の失敗を再現して、基盤となるコマンドの出力を収集します。提供された設定で正常に restore できるよう、R2 の restore 失敗を特定して解決できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
go, postgresql
領域
databases
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。