From 77113f68df81bc9c2a8c64fe475ecdf2950fc6c2 Mon Sep 17 00:00:00 2001 From: David Almgren Date: Tue, 26 May 2026 10:00:17 +0200 Subject: [PATCH] feat: expose showAdditionalCommandArgs and listAdditionalCommandArgs 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 #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. 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 #712 Signed-off-by: David Almgren --- .../barmancloud.cnpg.io_objectstores.yaml | 31 +++++++++++++++++++ manifest.yaml | 31 +++++++++++++++++++ web/docs/misc.md | 15 ++++++--- 3 files changed, 73 insertions(+), 4 deletions(-) diff --git a/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml b/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml index f8688ce0..5091f7dd 100644 --- a/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml +++ b/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml @@ -176,6 +176,37 @@ spec: format: int32 minimum: 1 type: integer + listAdditionalCommandArgs: + description: |- + ListAdditionalCommandArgs represents additional arguments that can be appended + to the 'barman-cloud-backup-list' command-line invocation. This command is + used internally for retention-policy enforcement; flags relevant to the + underlying S3 client (e.g. `--addressing-style=virtual` for strictly + virtual-hosted S3-compatible endpoints) generally belong here as well. + + Note: + It's essential to ensure that the provided arguments are valid and supported + by the 'barman-cloud-backup-list' command, to avoid potential errors or + unintended behavior during execution. + items: + type: string + type: array + showAdditionalCommandArgs: + description: |- + ShowAdditionalCommandArgs represents additional arguments that can be appended + to the 'barman-cloud-backup-show' command-line invocation. This command is + used after a successful upload to verify and record metadata about the + freshly-written backup, so flags relevant to the underlying S3 client + (e.g. `--addressing-style=virtual` for strictly virtual-hosted S3-compatible + endpoints) generally belong here as well. + + Note: + It's essential to ensure that the provided arguments are valid and supported + by the 'barman-cloud-backup-show' command, to avoid potential errors or + unintended behavior during execution. + items: + type: string + type: array type: object destinationPath: description: |- diff --git a/manifest.yaml b/manifest.yaml index 3b99c39b..676f89ee 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -175,6 +175,37 @@ spec: format: int32 minimum: 1 type: integer + listAdditionalCommandArgs: + description: |- + ListAdditionalCommandArgs represents additional arguments that can be appended + to the 'barman-cloud-backup-list' command-line invocation. This command is + used internally for retention-policy enforcement; flags relevant to the + underlying S3 client (e.g. `--addressing-style=virtual` for strictly + virtual-hosted S3-compatible endpoints) generally belong here as well. + + Note: + It's essential to ensure that the provided arguments are valid and supported + by the 'barman-cloud-backup-list' command, to avoid potential errors or + unintended behavior during execution. + items: + type: string + type: array + showAdditionalCommandArgs: + description: |- + ShowAdditionalCommandArgs represents additional arguments that can be appended + to the 'barman-cloud-backup-show' command-line invocation. This command is + used after a successful upload to verify and record metadata about the + freshly-written backup, so flags relevant to the underlying S3 client + (e.g. `--addressing-style=virtual` for strictly virtual-hosted S3-compatible + endpoints) generally belong here as well. + + Note: + It's essential to ensure that the provided arguments are valid and supported + by the 'barman-cloud-backup-show' command, to avoid potential errors or + unintended behavior during execution. + items: + type: string + type: array type: object destinationPath: description: |- diff --git a/web/docs/misc.md b/web/docs/misc.md index 0f03b284..1f6ac3c7 100644 --- a/web/docs/misc.md +++ b/web/docs/misc.md @@ -32,15 +32,22 @@ spec: [...] ``` -## Extra Options for Backup and WAL Archiving +## Extra Options for Backup, WAL Archiving, Show, and List -You can pass additional command-line arguments to `barman-cloud-backup` and -`barman-cloud-wal-archive` using the `additionalCommandArgs` field in the -`ObjectStore` configuration. +You can pass additional command-line arguments to each barman-cloud +invocation the plugin shells out to, using the matching +`additionalCommandArgs` fields in the `ObjectStore` configuration. - `.spec.configuration.data.additionalCommandArgs`: for `barman-cloud-backup` +- `.spec.configuration.data.showAdditionalCommandArgs`: for `barman-cloud-backup-show` (post-write verification) +- `.spec.configuration.data.listAdditionalCommandArgs`: for `barman-cloud-backup-list` (retention pruning) - `.spec.configuration.wal.archiveAdditionalCommandArgs`: for `barman-cloud-wal-archive` +If you need a flag that applies to every cloud command — such as +`--addressing-style=virtual` for an S3-compatible endpoint that only +accepts virtual-hosted-style requests — set it on all of the above so +both writes and the post-write read-back / retention steps honor it. + Each field accepts a list of string arguments. If an argument is already configured elsewhere in the plugin, the duplicate will be ignored.