Repository navigation
Description
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-checksumsor--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=syncfsSuggested behaviour:
-
It is an advanced option. The user is responsible for the arguments and for their compatibility with the PostgreSQL version in use.
pg_basebackupreports 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 newpg_basebackupoption 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_basebackupdocumentation:--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 fromexternalClusters), tablespace relocation (-T, see the tablespace mapping issue), and--helpand--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
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-][Feature]: Typed `pg_basebackup` options (sync method, max rate, checkpoint)[/-][+][Feature]: Add `additionalArgs` to the `pg_basebackup` bootstrap[/+]feat(bootstrap): support `additionalArgs` for `pg_basebackup` bootstr…
feat(bootstrap): support `additionalArgs` for `pg_basebackup` bootstr…