Skip to content

feat: pass additionalCommandArgs to barman-cloud-restore#914

Open
armru wants to merge 3 commits into
mainfrom
dev/821
Open

feat: pass additionalCommandArgs to barman-cloud-restore#914
armru wants to merge 3 commits into
mainfrom
dev/821

Conversation

@armru
Copy link
Copy Markdown
Member

@armru armru commented May 18, 2026

An ObjectStore already lets users tack extra command-line flags onto three of the four barman-cloud-* invocations: barman-cloud-backup via
data.additionalCommandArgs, barman-cloud-wal-archive via wal.archiveAdditionalCommandArgs, and barman-cloud-wal-restore via
wal.restoreAdditionalCommandArgs. The fourth — barman-cloud-restore, the actual data-restore step in PITR and recovery-from-object-store — has had no
equivalent, which is exactly the gap reported in #821 (the asker wanted a longer --read-timeout for slow restores from S3).

This PR fills that gap by adding spec.configuration.data.restoreAdditionalCommandArgs and wiring it into the recovery job hook. In restoreDataDir,
the user-supplied flags are appended after the cloud-provider options and --endpoint-url but before the positional (destinationPath, serverName, backupID, pgdata) arguments — same shape as the other three knobs. The library's existing append/dedup logic still wins on conflicts, so users can't
accidentally override flags the plugin already sets (--cloud-provider, --endpoint-url, etc.).

Sister PR (must merge first)

The CRD field is generated from the BarmanObjectStoreConfiguration Go type in cloudnative-pg/barman-cloud, so the actual API change lives upstream:
cloudnative-pg/barman-cloud#242 — which adds DataBackupConfiguration.RestoreAdditionalCommandArgs and the AppendRestoreAdditionalCommandArgs
helper. Once that PR merges and a barman-cloud release is cut, controller-gen here picks up the new field automatically.

go.mod is temporarily pinned to cloudnative-pg/barman-cloud#242 HEAD commit via a pseudo-version (v0.5.2-0.20260513095406-dac43abc6cf6) so CI on this branch can run
end-to-end against the unreleased upstream change. This pin must be replaced with a tagged barman-cloud release before this PR can merge.

Closes #821

@armru armru requested a review from a team as a code owner May 18, 2026 09:53
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. dependencies Pull requests that update a dependency file enhancement New feature or request go Pull requests that update go code labels May 18, 2026
armru added 3 commits May 18, 2026 12:01
Add support for the new `spec.configuration.data.restoreAdditionalCommandArgs`
field so operators can append flags (e.g. `--read-timeout`) to
barman-cloud-restore invocations, mirroring the existing
`wal.restoreAdditionalCommandArgs` behavior.

The new field is consumed by `restoreDataDir` and applied after the cloud
provider options and `--endpoint-url` but before the positional arguments,
so the upstream append/dedup logic can filter attempts to override official
options.

Depends on the corresponding upstream `barman-cloud` change in PR #242,
which introduces `DataBackupConfiguration.RestoreAdditionalCommandArgs`
and `AppendRestoreAdditionalCommandArgs`. go.mod pins that dependency to
the PR HEAD commit via a pseudo-version; bump it to a tagged release once
barman-cloud cuts one containing #242.

Closes #821

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Extend the "Extra Options" section in `misc.md` to cover
`barman-cloud-restore` alongside backup and WAL archiving, and add a
usage example for `.spec.configuration.data.restoreAdditionalCommandArgs`.

Refs #821

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
The 'Extra Options' section enumerated every additionalCommandArgs knob
except wal.restoreAdditionalCommandArgs, which already existed in the
API. Add the missing bullet and example so the list is complete.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Comment thread web/docs/misc.md
Comment on lines +37 to +39
You can pass additional command-line arguments to the underlying
`barman-cloud-*` commands using the corresponding fields in the `ObjectStore`
configuration.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention that already existing parameters configured by the plugin for the barman-cloud-* command will be ignored if configured also here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature or request go Pull requests that update go code size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't pass AdditionalCommandArgs to barman-cloud-restore

2 participants