Skip to content

fix: inject barman sidecar in replica clusters bootstrapped with pg_basebackup#965

Open
leonardoce wants to merge 3 commits into
cloudnative-pg:mainfrom
leonardoce:sidecar-pgbasebackup
Open

fix: inject barman sidecar in replica clusters bootstrapped with pg_basebackup#965
leonardoce wants to merge 3 commits into
cloudnative-pg:mainfrom
leonardoce:sidecar-pgbasebackup

Conversation

@leonardoce

Copy link
Copy Markdown
Contributor

Replica clusters that use pg_basebackup as the bootstrap method and stream WAL from an object store were not getting the barman sidecar injected, causing WAL restore to fail silently. These clusters are now handled correctly.

@leonardoce leonardoce requested a review from a team as a code owner June 16, 2026 14:37
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working go Pull requests that update go code labels Jun 16, 2026
@leonardoce leonardoce force-pushed the sidecar-pgbasebackup branch from a336b5a to 55a47cf Compare June 16, 2026 14:37
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 17, 2026
@armru armru force-pushed the sidecar-pgbasebackup branch from 55a47cf to 70dd50f Compare June 18, 2026 12:56
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jun 18, 2026
leonardoce and others added 3 commits June 18, 2026 16:48
…asebackup

Replica clusters that use `pg_basebackup` as the bootstrap method and stream
WAL from an object store were not getting the barman sidecar injected, causing
WAL restore to fail silently. These clusters are now handled correctly.

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
…up replicas

The sidecar injected into pg_basebackup replica clusters ignored the
instanceSidecarConfiguration (resources, logLevel, additionalContainerArgs) of
the replica-source ObjectStore: collectSidecarResourcesForPod and
collectAdditionalInstanceArgs only handled the cluster and recovery object
stores. Log-shipping replicas masked this because their recovery and replica
source object stores coincide; pg_basebackup replicas only set
ReplicaSourceBarmanObjectName, so the configuration was silently dropped (the
sidecar ran with no additional args and the default log level).

Handle ReplicaSourceBarmanObjectName in both helpers, documenting the store
precedence (Barman > Recovery > ReplicaSource), and fix the misleading comment
on the recovery branch.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Add config-package tests exercising the parse path the pg_basebackup replica
fix lives in: NewFromCluster must derive ReplicaSourceBarmanObjectName from the
external cluster plugin (while leaving the backup and recovery object stores
empty) and Validate must accept it. Also assert that a replica source backed by
a different plugin is ignored.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
@armru armru force-pushed the sidecar-pgbasebackup branch from 70dd50f to 2d64d34 Compare June 18, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants