Commit Graph

62 Commits

Author SHA1 Message Date
Peggie
69970395e2
chore(main): release 0.7.0 (#506)
Signed-off-by: Peggie <info@cloudnative-pg.io>
2025-09-25 11:28:56 +02:00
Leonardo Cecchi
08c3f1c232
feat: return proper gRPC error codes for expected conditions (#549)
The plugin now returns a 404 status code when a requested WAL file does
not exist in the object store.

This prevents misleading log entries such as "Error while handling gRPC
request" for expected missing-file scenarios.

The `ErrEndOfWALStreamReached` now returns `OutOfRange` error.

The `ErrMissingPermissions` now returns `FailedPrecondition` error.

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-09-25 10:36:48 +02:00
Armando Ruocco
0501e185ba
feat: introduce logLevel setting to control verbosity (#536)
This commit adds a new `logLevel` field to the plugin configuration,
allowing users to select the desired log verbosity for the instances
(e.g. error, warning, info, debug, trace).

Closes #514 

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Co-authored-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
2025-09-24 12:32:59 +02:00
Marco Nenciarini
a29aa1c91a
fix(logs): log the correct name when on ObjectStore not found error (#540)
Closes #539

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-09-22 10:26:43 +02:00
Leonardo Cecchi
dfd9861a3f
fix: avoid panicking if serverRecoveryWindow has still not been set (#525)
Closes: #523

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-09-18 15:28:53 +02:00
Armando Ruocco
ec352ac0fd
feat(spec): add support for additional sidecar container arguments (#520)
Introduce the `additionalContainerArgs` field in the `ObjectStore` resource.
It allows specifying an optional list of command-line arguments appended to
the Barman Cloud sidecar container at startup.

Closes #501 

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Co-authored-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
2025-09-17 18:35:37 +02:00
Marco Nenciarini
8c3db955ef
fix(object-cache): improve reliability of object cache management (#508)
* make sure objects expire after DefaultTTLSeconds
* make cached objects have GKV information
* fix cache retrieval and removal logic

Closes #502

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
2025-09-12 11:31:59 +02:00
Marco Nenciarini
3c0d8c3a33
fix: typo in variable name (#515)
The environment variable CUSTOM_CNPG_VERSION (set in `internal/cnpgi/operator/lifecycle.go`)
is read as CUSTOM_CNPG_VERSIONXS in `internal/cmd/instance/main.go`.

```
$git grep -n CUSTOM_CNPG_VERSION
internal/cmd/instance/main.go:42:       _ = viper.BindEnv("custom-cnpg-version", "CUSTOM_CNPG_VERSIONXS")
internal/cnpgi/operator/lifecycle.go:299:                       Name:  "CUSTOM_CNPG_VERSION",
```

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-09-10 15:15:59 +02:00
Peggie
b556fea179
chore(main): release 0.6.0 (#388)
Signed-off-by: Peggie <info@cloudnative-pg.io>
2025-08-21 14:33:58 +02:00
Gabriele Fedi
e0c8b64470
fix: add cluster/finalizers update permission (#465)
Add the required missing permission to operate in k8s
environments where the Admission Controller
Plugin "OwnerReferencesPermissionEnforcement"
is enabled.

Signed-off-by: Gabriele Fedi <gabriele.fedi@enterprisedb.com>
2025-08-14 22:55:25 +02:00
Leonardo Cecchi
e40ba7065a
fix(unit-tests): metrics collect length (#475)
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-08-14 17:01:56 +02:00
Leonardo Cecchi
551a3cde09
feat: last failed backup status field and metric (#467)
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Co-authored-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
2025-08-12 14:32:54 +10:00
Armando Ruocco
33172b6466
feat: add upstream backup and recovery metrics (#459)
Introduce two new Prometheus metrics sourced from the Barman Cloud plugin:

- `barman_cloud_cloudnative_pg_io_first_recoverability_point`
- `barman_cloud_cloudnative_pg_io_last_available_backup_timestamp`

These metrics supersede the following deprecated CNPG metrics:

- `cnpg_collector_first_recoverability_point`
- `cnpg_collector_last_available_backup_timestamp`

Depends on: https://github.com/cloudnative-pg/cloudnative-pg/pull/8033

Relates to: #380 

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-08-08 09:15:19 +10:00
Leonardo Cecchi
950364b955
fix: check for empty WAL archive during WAL archiving (#458)
In the in-tree barman-cloud implementation, the check for an empty WAL
archive is performed both immediately after the restore process and when the
first WAL file is archived.

Previously, the plugin-based implementation only performed this check after
restore, skipping it during archiving of the first WAL. This patch restores
parity with the in-tree behavior by ensuring the check is also performed
during WAL archiving.

Closes: #457

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-08-07 09:03:21 +10:00
Jonathan Gonzalez V.
2a75d40356
fix: logic to retrieve ObjectStore from cache (#429)
There was mistake on the object used to compare the ObjectStore, we were
using a type Secret instead of ObjectStore.

Also, make it more clear the logic to retrieve the cached objects by getting
the cached objects when are cached.

Signed-off-by: Jonathan Gonzalez V. <jonathan.gonzalez@enterprisedb.com>
2025-07-02 11:12:54 +02:00
Peggie
c42bdfe455
chore(main): release 0.5.0 (#383)
Signed-off-by: Peggie <info@cloudnative-pg.io>
2025-06-03 18:20:09 +02:00
Marco Nenciarini
40316b5f2d
fix: remove lifecycle Pod Patch subscription (#378)
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
2025-06-03 10:48:39 +02:00
Peggie
44db26fd99
chore(main): release 0.4.1 (#358)
Signed-off-by: Peggie <info@cloudnative-pg.io>
2025-05-29 11:10:28 +02:00
Marco Nenciarini
918823dbf1
fix: do not add barman-certificates projection if not needed (#354)
Closes #347 #364

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
2025-05-28 18:12:53 +02:00
Peggie
612064bae3
chore(main): release 0.4.0 (#269)
Signed-off-by: Peggie <info@cloudnative-pg.io>
2025-05-12 13:04:51 +02:00
Leonardo Cecchi
4bb347121d
feat(sidecar): add resource requirements and limits (#307)
Closes #253

Signed-off-by: MichaluxPL <68371308+MichaluxPL@users.noreply.github.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Co-authored-by: MichaluxPL <68371308+MichaluxPL@users.noreply.github.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
2025-05-09 17:32:02 +02:00
Leonardo Cecchi
8c20e4fe85
fix: duplicate certificate projections (#331)
When referring to the same ObjectStore with custom TLS certificates
multiple times, the plugin was adding the same volume projection two
times. This lead to a wrong Job definition.

This patch makes the plugin add a sidecar to replica cluster Pods that
are using the plugin to get WALs, even if the plugin itself is not used
for WAL archiving.

Closes: #329

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-05-09 14:27:20 +02:00
Leonardo Cecchi
f484b9e748
fix: role patching (#325)
Closes: #318

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-05-08 11:58:31 +02:00
Leonardo Cecchi
9db184f5d4
feat: log the downloaded backup catalog before restore (#323)
Closes: #319

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-05-08 10:51:35 +02:00
MichaluxPL
88fd3e504f
feat(wal): parallel WAL archiving (#262)
This patch allows the plugin to archive WAL files in parallel.

Fix: #260
Fix: #266

Signed-off-by: MichaluxPL <68371308+MichaluxPL@users.noreply.github.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Co-authored-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
2025-04-22 10:21:17 +02:00
Marco Nenciarini
e00024f136
feat: support snapshot recovery job (#258)
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-04-16 11:45:52 +02:00
Peggie
860cf23aa2
chore(main): release 0.3.0 (#205)
Signed-off-by: Peggie <info@cloudnative-pg.io>
2025-03-28 18:47:50 +01:00
Francesco Canovai
d711a962e6 chore: remove embedded fields
The new version of golangci-lint prefers embedded fields not to be
included.

Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
2025-03-27 16:15:29 +01:00
Marco Nenciarini
c3ee1ffd16
chore: remove support for Barman <= 3.4 (#231)
Signed-off-by: Marco Nenciarini <mnencia@kcore.it>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-03-27 15:33:34 +01:00
Francesco Canovai
6c6fdc0a7a
ci: update version in metadata (#229)
Fix the release-please configuration to update the version defined in
the code.

Closes #226

Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
2025-03-25 17:21:56 +01:00
Leonardo Cecchi
bac7b673a2
fix: custom CA support for retention policies (#224)
Closes #220

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-03-24 18:21:47 +01:00
Jonathan Battiato
5788c1f727
fix: controller and sidecar containers run as non-root (#225)
Closes #177

Signed-off-by: Jonathan Battiato <jonathan.battiato@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-03-23 17:00:52 +01:00
Leonardo Cecchi
a7ef56b6e7
feat: implement evaluate lifecycle hook (#222)
This patch allows the plugin trigger a rolling deployment on existing
clusters, enabling seamless migration between the in-tree barman cloud
support and the plugin.

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-03-21 14:49:55 +01:00
Marco Nenciarini
56d8cceb3b
feat: upgrade Barman to 3.13.0 (#209)
Upgrade Barman to 3.13.0 and adjust the argument order in
`barman-cloud-restore` to work around the regression described in
cloudnative-pg/cloudnative-pg#6932.

Closes #208

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-03-20 14:35:26 +01:00
Leonardo Cecchi
fecd1e9513
feat: retention policy (#191)
This commit makes the Barman cloud plugin support the enforcement of
retention policy as provided by the barman-cloud tool suite.

The first recoverability point and the last successful backup are
shown in the status of the ObjectStore resource for each involved
server name.

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-03-18 17:35:22 +01:00
Leonardo Cecchi
13e3fab268
feat: lenient decoding of CNPG resources (#192)
This patch enables the barman-cloud plugin to function with an operator
that is structurally identical to CNPG but works with a different API group.

It achieves this through lenient decoding of the provided CNPG resources
and injecting the detected GVK into the sidecar, enabling it to correctly
encode and decode the Kubernetes resources.

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-03-14 12:23:23 +01:00
Leonardo Cecchi
fcbc472092
feat: support custom CA certificates (#198)
This patch enables the use of custom CA certificates when connecting
to the object store in the barman-cloud plugin. The certificates are
injected into the sidecar via a projected volume and used by the
barman-cloud tool suite.

If the barman object name or the key name changes, users must trigger
a Pod rollout to apply the new values.

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-03-13 12:05:13 +01:00
Marco Nenciarini
dfbeaf802e
fix(deps): use latest commit from CNPG 1.25 branch (#178)
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-02-27 15:26:46 +01:00
Marco Nenciarini
5dde0c18cd
chore: remove unused Cluster informer cache (#161)
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-02-24 18:05:28 +01:00
renovate[bot]
0c8ff7426f
fix(deps): update module github.com/cloudnative-pg/api to v1 (#131)
| datasource | package                       | from                               | to      |
| ---------- | ----------------------------- | ---------------------------------- | ------- |
| go         | github.com/cloudnative-pg/api | v0.0.0-20241209133608-a48d55a7861d | v1.25.0 |


Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Co-authored-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
2024-12-24 10:09:58 +01:00
Leonardo Cecchi
4656d44c85
fix: replica source object store on replica clusters being promoted (#96)
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2024-12-11 16:52:55 +01:00
Leonardo Cecchi
9ed845c10f
chore: graceful startup probe (#95)
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2024-12-11 15:57:42 +01:00
Leonardo Cecchi
e4735a2f85
feat: separate recovery object store from replica source (#83)
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
2024-12-09 13:29:20 +01:00
Leonardo Cecchi
be4037529c
feat: additional environment variables (#81)
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Co-authored-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
2024-12-05 13:18:18 +01:00
Leonardo Cecchi
e30edd2318
feat: separate recovery and cluster object store (#76)
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Co-authored-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
2024-12-05 12:05:14 +01:00
Francesco Canovai
af60a15837
test(e2e): backup and restore (#71)
Run basic backup and restore tests for the plugin. Use MinIO for S3,
Azurite for ACS and fake-gcs-server for GCS.

Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
2024-12-02 15:53:34 +01:00
Armando Ruocco
5fd9449b27
feat: add liveness and readiness probe support (#69)
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Co-authored-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
2024-12-02 14:51:32 +01:00
Leonardo Cecchi
9d8fa079fe
fix: exit code 0 on clean shutdown (#70)
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2024-11-29 16:15:04 +01:00
Armando Ruocco
afd4603023
fix: ensure restore configuration points to manager wal-restore (#68)
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Co-authored-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
2024-11-28 14:04:50 +01:00
Leonardo Cecchi
9c77e3de9f
fix: avoid injecting the plugin environment into the PG container (#62)
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2024-11-22 16:35:01 +01:00