Repository navigation
feat(bootstrap): support additionalArgs for pg_basebackup bootstrap - #11595
Merged
Merged
Conversation
Contributor
|
❗ By default, the pull request is configured to backport to all release branches.
|
additionalArgs for pg_basebackup bootstrap
gbartolini
force-pushed
the
pgbasebackup-addargs
branch
from
October 8, 2026 16:53
82430b8 to
700b975
Compare
Contributor
|
I have tested this by deploying apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-replica-tls
spec:
instances: 3
bootstrap:
pg_basebackup:
source: cluster-example
additionalArgs:
- --max-rate=50M
- --checkpoint=fast
- --sync-method=syncfs
replica:
primary: cluster-example
source: cluster-example
storage:
size: 1Gi
externalClusters:
- name: cluster-example
connectionParameters:
host: cluster-example-rw.default.svc
user: streaming_replica
sslmode: verify-full
dbname: postgres
sslKey:
name: cluster-example-replication
key: tls.key
sslCert:
name: cluster-example-replication
key: tls.crt
sslRootCert:
name: cluster-example-ca
key: ca.crtThen checked the logs, and verified this line: |
gbartolini
approved these changes
Oct 12, 2026
armru
force-pushed
the
pgbasebackup-addargs
branch
from
October 12, 2026 15:17
700646b to
a5870e5
Compare
armru
approved these changes
Oct 12, 2026
armru
force-pushed
the
pgbasebackup-addargs
branch
from
October 12, 2026 15:27
a5870e5 to
f08552e
Compare
Member
|
/test |
Contributor
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/38270333656 |
armru
force-pushed
the
pgbasebackup-addargs
branch
from
October 13, 2026 07:41
f08552e to
ce783d7
Compare
Member
|
/ok-to-merge |
Users can now set spec.bootstrap.pg_basebackup.additionalArgs to pass custom flags to the pg_basebackup invocation, e.g. --checkpoint=fast or --compress=lz4. Signed-off-by: Leonardo Cecchi <[email protected]>
…e command Rework the additionalArgs section of the bootstrap page with a more meaningful example (--max-rate, --checkpoint, --sync-method), explain the arguments, and state that the option is advanced, untested in combination and bootstrap-only. Log the effective `pg_basebackup` options before executing the command. Signed-off-by: Gabriele Bartolini <[email protected]>
Reject, in `spec.bootstrap.pg_basebackup.additionalArgs`, the `pg_basebackup` options the operator relies on: target and format (-D, -F, -R, -X, -t, --waldir), connection (-d, -h, -p, -U, -w, -W), tablespace mapping (-T), and --help/--version. Grouped short options and abbreviated long options are detected too, as getopt_long accepts them. Update the API documentation to reflect that only these options are validated. Signed-off-by: Gabriele Bartolini <[email protected]>
forbiddenPgBaseBackupOption returned the option, the reason and a found flag, which the only caller immediately joined into one message. Build the message in the helper and return an empty string for an accepted argument. Signed-off-by: Armando Ruocco <[email protected]>
…command Check that the arguments set in additionalArgs reach the pgbasebackup command and survive the shell quoting round trip, including a value with spaces and quotes. Signed-off-by: Armando Ruocco <[email protected]>
…t slot With --create-slot, pg_basebackup creates a permanent physical replication slot on the source instead of a temporary one. The new cluster never uses it, as neither the new primary nor a replica cluster configures that slot, so the source keeps retaining WAL until its disk fills up. Reject -C and --create-slot in additionalArgs, and point the API comment to the documented list of rejected options instead of repeating an incomplete one. Signed-off-by: Armando Ruocco <[email protected]>
armru
force-pushed
the
pgbasebackup-addargs
branch
from
October 13, 2026 09:29
ce783d7 to
16db580
Compare
cnpg-bot
pushed a commit
to cloudnative-pg/api
that referenced
this pull request
Oct 13, 2026
…ap (cloudnative-pg/cloudnative-pg#11595) Add an optional `additionalArgs` list under `spec.bootstrap.pg_basebackup`. The arguments are appended to the `pg_basebackup` command built by the operator, so advanced users can tune the copy of a large data directory without patching generated objects: ```yaml spec: bootstrap: pg_basebackup: source: cluster-example additionalArgs: - --max-rate=50M - --checkpoint=fast - --sync-method=syncfs ``` Closes cloudnative-pg/cloudnative-pg#11622 Closes cloudnative-pg/cloudnative-pg#11379 --------- Signed-off-by: Leonardo Cecchi <[email protected]> Signed-off-by: Gabriele Bartolini <[email protected]> Signed-off-by: Armando Ruocco <[email protected]> Co-authored-by: Gabriele Bartolini <[email protected]> Co-authored-by: Armando Ruocco <[email protected]> (cherry picked from commit cloudnative-pg/cloudnative-pg@71b37de)
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an optional
additionalArgslist underspec.bootstrap.pg_basebackup.The arguments are appended to the
pg_basebackupcommand built by the operator, so advanced users can tune the copy of a large data directory without patching generated objects:Closes #11622
Closes #11379