Compare commits

..

4 Commits

Author SHA1 Message Date
Marco Nenciarini
a9aada1916 fix: stop keeping the sidecar forever on recovery-only clusters
A cluster bootstrapped only via RecoveryBarmanObjectName, with no
continuing archiving or replica source, only ever needs the sidecar
for its one-time bootstrap restore. Gate its injection on
cluster.Status.CurrentPrimary being unset, so it stops being added
once that instance is up.

CurrentPrimary is set by the instance manager itself, from inside the
primary pod, only once it has completed its own bootstrap - unlike
cluster.Status.Instances / IsInitialized(), which flips as soon as the
instance's PVC exists, well before the pod is even created. Gating on
IsInitialized() would mean the sidecar is never added to the one pod
that needs it to perform its restore.

Once CurrentPrimary is set, this makes the operator's own drift-check
see the already-running pod's spec as outdated and roll it out to drop
the sidecar. That is deliberately accepted rather than engineered
around: it is one deterministic rollout using the same machinery the
operator already uses for every other pod-spec change (a switchover if
a replica is available, an in-place restart otherwise), not a new or
fragile risk.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-08-14 16:45:37 +02:00
Marco Nenciarini
75d9b9e4be refactor: deduplicate barman object store presence check
Validate() and the instance sidecar injection condition each
independently re-encoded "is any of BarmanObjectName,
RecoveryBarmanObjectName or ReplicaSourceBarmanObjectName set". The
injection condition had already drifted from Validate() once, missing
RecoveryBarmanObjectName until this PR added it back. Extract a single
HasAnyBarmanObjectStore() method so the two checks can no longer drift
apart the same way again.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-08-14 16:45:37 +02:00
Armando Ruocco
b7e6934516 feat: serve restore hooks from the instance sidecar
The bootstrap that used to run in a dedicated recovery Job now happens
in-process inside the instance pod before PostgreSQL starts, so the sidecar
shipped in that pod must answer the same Restore RPC the operator sends over
the plugin sockets. The instance mode now registers the restore job hooks and
advertises the restore-job service capability so the operator can reach them.
A cluster that only bootstraps from an object store, without continued
archiving, previously received no sidecar in its instance pods; the injection
condition is widened to match what the plugin configuration already considers
valid, so those clusters get the sidecar too.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
2026-08-14 16:45:37 +02:00
Gabriele Bartolini
9967e2caab
chore: sync CODEOWNERS with cnpg-infra policy (#1047)
Regenerates this repo's CODEOWNERS from cloudnative-pg/cnpg-infra's
`componentowners-policy.yaml`, the org's tracked desired state for
CODEOWNERS content.

- Routes ownership through this repo's dedicated GitHub owners team
instead of hardcoded usernames, so membership changes are picked up
automatically.
- Any path-scoped rule now also includes the repo's general owners, so a
path rule adds reviewers rather than silently replacing the `*` rule's
owners for that subtree (CODEOWNERS only honors the last matching
pattern, it does not merge).

See cloudnative-pg/cnpg-infra for the policy this is generated from.

Assisted-by: Claude

Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
2026-08-06 19:30:12 +10:00

View File

@ -1,5 +1,9 @@
# The CODEOWNERS file is used to define individuals or teams that are # This file is generated from componentowners-policy.yaml in
# responsible for code in a repository. For details, please refer to # cloudnative-pg/cnpg-infra — do not hand-edit, propose changes there instead.
# https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/about-code-owners #
# Path-scoped rules below always include the repo's own general owners
# (the "*" line) in addition to their own specific teams/users, since
# CODEOWNERS only honors the LAST matching pattern for a given path —
# it does not merge an earlier, less-specific rule into a later one.
* @leonardoce @mnencia @gbartolini @fcanovai @armru @NiccoloFei * @cloudnative-pg/plugin-barman-cloud-owners