Skip to content

feat: expose showAdditionalCommandArgs and listAdditionalCommandArgs#924

Open
davidalmgren95 wants to merge 1 commit into
cloudnative-pg:mainfrom
davidalmgren95:dev/712
Open

feat: expose showAdditionalCommandArgs and listAdditionalCommandArgs#924
davidalmgren95 wants to merge 1 commit into
cloudnative-pg:mainfrom
davidalmgren95:dev/712

Conversation

@davidalmgren95
Copy link
Copy Markdown

@davidalmgren95 davidalmgren95 commented May 26, 2026

Summary

An ObjectStore already lets users tack extra command-line flags onto four of the six barman-cloud-* invocations the plugin shells out to:

barman command existing field
barman-cloud-backup data.additionalCommandArgs
barman-cloud-wal-archive wal.archiveAdditionalCommandArgs
barman-cloud-wal-restore wal.restoreAdditionalCommandArgs
barman-cloud-restore data.restoreAdditionalCommandArgs (#914)

The remaining two — barman-cloud-backup-show (post-write verification) and barman-cloud-backup-list (retention pruning) — had no equivalent, which is the gap reported in #712.

This is observable in practice on S3-compatible endpoints that strictly require virtual-hosted-style addressing for LIST. On such backends:

  • barman-cloud-backup accepts user-provided --addressing-style=virtual via the existing data.additionalCommandArgs ✅ — base backup completes and lands in the bucket
  • barman-cloud-backup-show runs immediately afterwards with no way to thread the flag through, sends path-style by default, gets PathStyleRequestNotAllowed, exits with status 4
  • The plugin marks the otherwise-successful backup as phase: failed
  • Retention pruning (which goes via barman-cloud-backup-list) is similarly broken — old backups silently never get expired

So user-visible Backup CR status is wrong and retention is silently disabled, even though the actual base-backup data is intact in the bucket. The Backup CRs from such clusters look like:

```
NAME AGE METHOD PHASE ERROR
my-cluster-db-backup-20260524000000 2d11h plugin failed rpc error: code = Unknown desc = exit status 4
my-cluster-db-backup-20260525000000 35h plugin failed rpc error: code = Unknown desc = exit status 4
```

with plugin logs showing:

```
{level:info, msg:"Starting barman-cloud-backup", options:[..., "--addressing-style=virtual", ...]}
{level:info, msg:"Completed barman-cloud-backup", ...}
{level:error, logger:"barman", msg:"Can't extract backup id", command:"barman-cloud-backup-show",
options:["--format","json","--endpoint-url",...,"--cloud-provider","aws-s3","s3://bucket/path/","server-name","backup-..."],
stderr:"ERROR: Barman cloud backup show exception: An error occurred (PathStyleRequestNotAllowed)\n"}
```

Note the --addressing-style=virtual is present on the first invocation but missing on the second.

Changes

  • New CRD fields under spec.configuration.data:
    • showAdditionalCommandArgs (passed to barman-cloud-backup-show)
    • listAdditionalCommandArgs (passed to barman-cloud-backup-list)
  • CRD YAML in config/crd/bases/barmancloud.cnpg.io_objectstores.yaml and manifest.yaml updated to include the two new array fields
  • web/docs/misc.md updated to list all four args fields, with a note on the cross-cutting --addressing-style=virtual use case

No Go code changes are needed in this repo — the actual plumbing lives in the sister PR against cloudnative-pg/barman-cloud#249, which adds the matching Go fields, Append* helpers, and the call-site changes inside GetBackupByName and GetBackupList. Once that PR merges and a barman-cloud release is cut, bumping go.mod here will pick up the new behavior automatically.

Sister PR (must merge first)

cloudnative-pg/barman-cloud#249

Closes #712

@davidalmgren95 davidalmgren95 requested a review from a team as a code owner May 26, 2026 10:09
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels May 26, 2026
An ObjectStore lets users tack extra command-line flags onto four of
the six barman-cloud-* invocations the plugin shells out to:
barman-cloud-backup (data.additionalCommandArgs), -wal-archive
(wal.archiveAdditionalCommandArgs), -wal-restore
(wal.restoreAdditionalCommandArgs), and -restore (data.restoreAdditionalCommandArgs,
PR cloudnative-pg#914).

The remaining two -- barman-cloud-backup-show (post-write verification)
and barman-cloud-backup-list (retention pruning) -- had no equivalent,
which is the gap reported in cloudnative-pg#712. On strictly-vhost S3-compatible
endpoints users need `--addressing-style=virtual` on every cloud
command, and currently those two reject the user-provided args, marking
otherwise-successful backups as failed and silently disabling retention
pruning.

The library-side change adds the two new fields and helpers (sister PR
in cloudnative-pg/barman-cloud) and threads them through GetBackupList /
GetBackupByName. This plugin commit just exposes them via the CRD and
documents the new shape.

## Sister PR (must merge first)

The CRD field schema is generated from the BarmanObjectStoreConfiguration
Go type in cloudnative-pg/barman-cloud. The sister PR there adds:

- DataBackupConfiguration.ShowAdditionalCommandArgs []string
- DataBackupConfiguration.ListAdditionalCommandArgs []string
- AppendShowAdditionalCommandArgs / AppendListAdditionalCommandArgs helpers

Once that PR merges and a barman-cloud release is cut, controller-gen
here picks up the new fields automatically. Until then a developer
running \`go test ./...\` against this branch needs a local replace
directive in go.mod pointing at the barman-cloud branch (omitted from
this commit).

Closes cloudnative-pg#712

Signed-off-by: David Almgren <dalmgren@coreweave.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] barman-cloud plugin should support virtual-hosted style addressing for S3-compatible storage

1 participant