Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Record the object store and server name of a backup in Backup.status.pluginMetadata

未关闭
#1,140 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@BoxBoxJason 已经在做这个了。

开始于 2026年10月4日。

  • #1141 来自 @BoxBoxJason —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
停滞
技术栈
go, postgresql
领域
databases

调研方向

Start in internal/cnpgi/instance/types.go at newBackupResultMetadata, then trace how the plugin resolves the ObjectStore and serverName for a backup. Check the existing backup/plugin tests and add coverage for the proposed metadata keys, including the optional endpointURL. Done means Backup.status.pluginMetadata records the backup location and resolved server name without changing existing metadata.

由索引模型根据 Issue 内容生成。

描述

Description

A Backup taken through the plugin doesn't record which ObjectStore and which serverName the backup was written to. When creating a recovery cluster, we have to find that out by other means and write it by hand in the externalClusters entry.
I'd like the plugin to add this information to the backup result metadata, so that it ends up in Backup.status.pluginMetadata.

This is related to #510 and cloudnative-pg/cloudnative-pg#7989 (recovery from a plugin Backup object), which I believe need this as a first step.

Our use case

Our clusters archive under a timestamped serverName (for example mydb-20261003T120000), set through the serverName plugin parameter, and a new one is generated for each new generation of a cluster.
The archive path has to be empty when a cluster starts archiving, and a fresh, dated serverName gives us that without deleting older archives.
Over time, the bucket holds one folder per generation.

To create a recovery cluster from a given backup, we need to know which of these folders holds it. The plugin's recovery default for serverName is the name of the new cluster (internal/cnpgi/operator/config/config.go), which never matches a timestamp, so we have to find the value by listing the bucket or
digging through old manifests.
The Backup object is the natural place to keep the link between a backup and its location, and it's where the in-tree integration kept it: Backup.status.serverName, destinationPath and endpointURL were all set. Since the in-tree integration is deprecated since 1.26, anyone migrating to the plugin loses that.

Environment
  • CloudNativePG operator: main (the behaviour is the same on current releases)
  • plugin-barman-cloud: v0.15.1
What a plugin backup records today
apiVersion: postgresql.cnpg.io/v1
kind: Backup
spec:
  method: plugin
  pluginConfiguration:
    name: barman-cloud.cloudnative-pg.io
status:
  backupId: ...
  pluginMetadata:
    clusterUID: ...
    displayName: ...
    name: ...
    pluginName: ...
    timeline: "1"
    version: ...

Nothing in it says where the backup went. newBackupResultMetadata (internal/cnpgi/instance/types.go) is where these keys are built.

Proposal

Add the configuration the backup was taken with to the same map:

Key Value
barmanObjectName name of the ObjectStore used for the backup
serverName resolved server name (the serverName parameter, or the cluster name when unset)
destinationPath ObjectStore.spec.configuration.destinationPath at backup time
endpointURL ObjectStore.spec.configuration.endpointURL at backup time, when set

This only adds keys and doesn't change any existing behaviour. destinationPath and endpointURL aren't strictly needed to locate the data, since they can be read from the ObjectStore, but they let a later restore detect that the ObjectStore has been changed to point somewhere else since the backup was taken.

Shipping this early matters even if nothing consumes it yet: backups taken before it lands will never carry the information.

Alternatives considered
  • Dedicated fields in Backup.status (serverName, destinationPath): they would need new fields in the CNPG-I BackupResult message for concepts that are specific to Barman, so pluginMetadata looks like the right place.
  • Keep the status quo and document that serverName must always be set in the recovery source.
    This is what we do today, but with timestamped names the value has to be found outside the cluster.
  • Change the default recovery serverName: no default can guess a timestamp, and changing it would break users who rely on the current one.

I used an AI assistant (Claude) to help draft this issue and to check the references against the plugin and operator sources, as the AI policy asks for disclosure.

主要语言
Go
星标
196
派生
76
平均合并
4 天 13 小时
30 天内合并 PR
19

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cloudnative-pg/plugin-barman-cloud 的其他 Issue

查看 cloudnative-pg/plugin-barman-cloud 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。