Skip to content

[Feature]: Add additionalArgs to the pg_basebackup bootstrap #11622

Description

@gbartolini

Is there an existing issue already for this feature request/idea?

  • I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.

What problem is this feature going to solve? Why should it be added?

CloudNativePG builds the pg_basebackup command internally and exposes none of its options. Users who know exactly what they need, for example, on very large data directories or when cloning a live production source from outside Kubernetes, cannot apply options such as:

  • --sync-method=syncfs (PostgreSQL 17 and later), to avoid a slow per-file fsync phase
  • --max-rate, to limit the impact on the source
  • --checkpoint=fast, to avoid waiting for a spread checkpoint
  • --manifest-checksums or --no-estimate-size

The only workarounds are running pg_basebackup by hand, which bypasses the operator, or patching generated objects, which is not durable.

Describe the solution you'd like

An optional additionalArgs list of strings under bootstrap.pg_basebackup, appended to the command built by the operator.

spec:
  bootstrap:
    pg_basebackup:
      source: cluster-example
      additionalArgs:
      - --max-rate=50M
      - --checkpoint=fast
      - --sync-method=syncfs

Suggested behaviour:

  • It is an advanced option. The user is responsible for the arguments and for their compatibility with the PostgreSQL version in use. pg_basebackup reports its own errors, which appear in the instance logs.

  • The effective command line is logged at start. The connection string references a password file, so it contains no secret.

  • Documentation stays low-key: the API reference, plus a short advanced note on the Bootstrap page warning that argument combinations are not tested by the project.

  • Tests cover the generated command and the webhook validation.

Scope: bootstrap only. Replica joins share the same code path, but extending the option to them (the syncfs request in #11379 covers joins and rebuilds) is left for a separate discussion.

Describe alternatives you've considered

  • Typed fields (syncMethod, maxRate, checkpoint): considered and set aside. Every new pg_basebackup option would need an API change, version-specific validation and a release, for options only advanced users need.
  • The same trade-off applies to initdb.options, which was deprecated because arguments can break the operator. Here we accept it, with an explicit advanced status and, if possible, a small denylist of arguments the operator depends on.
  • Patching the generated objects: not durable, and not supported.

Additional context

  • pg_basebackup documentation: --sync-method, --max-rate, --checkpoint.
  • Open questions: whether a denylist is wanted at all, or the user takes full responsibility; whether replica joins should get an equivalent field.
  • Can the webhook reject the few arguments that cannot work because the operator relies on them? For example: target and format (-D, -F, -R, -X, --waldir, -t), connection (-d, -h, -p, -U, -w, -W, taken from externalClusters), tablespace relocation (-T, see the tablespace mapping issue), and --help and --version.

Backport?

No

Are you willing to actively contribute to this feature?

Yes

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added this to the 1.31.0 milestone on Oct 6, 2026
  2. self-assigned this
    on Oct 6, 2026
  3. added
    enhancement 🪄
    on Oct 6, 2026
  4. changed the title [-][Feature]: Typed `pg_basebackup` options (sync method, max rate, checkpoint)[/-] [+][Feature]: Add `additionalArgs` to the `pg_basebackup` bootstrap[/+] on Oct 8, 2026
  5. moved this from Waiting for Second Review to Done in CloudNativePG operator developmenton Oct 13, 2026
  6. added a commit that references this issue on Oct 13, 2026
    f3665c3
  7. added a commit that references this issue on Oct 13, 2026
    71b37de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement 🪄

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions