Commit Graph

86 Commits

Author SHA1 Message Date
Peggie
1cd26c9286
chore(main): release 0.13.0 (#860)
Some checks failed
Deploy Docusaurus to GitHub Pages / build (push) Failing after 5s
Deploy Docusaurus to GitHub Pages / deploy (push) Has been skipped
release-please / release-please (push) Failing after 3s
Signed-off-by: Peggie <info@cloudnative-pg.io>
2026-06-10 10:55:17 +02:00
Niccolò Fei
bb7845dd62
fix(scheme): register meta types for CNPG scheme group version (#943)
Some checks failed
release-please / release-please (push) Failing after 5s
After the controller-runtime v0.24.0 upgrade (58f4fed), the instance
sidecar logged "v1.GetOptions is not suitable for converting to
postgresql.cnpg.io/v1" on every WAL archive, which broke retention
policy enforcement.

Register the standard meta types with metav1.AddToGroupVersion after the
AddKnownTypes call in internal/cnpgi/common/scheme.go and
internal/scheme/cnpg.go.

Closes #942

Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
2026-06-08 11:08:15 +02:00
Armando Ruocco
c5f149b86a
feat: pass additionalCommandArgs to barman-cloud-restore (#914)
Some checks failed
Deploy Docusaurus to GitHub Pages / build (push) Failing after 5s
Deploy Docusaurus to GitHub Pages / deploy (push) Has been skipped
release-please / release-please (push) Failing after 3s
An `ObjectStore` already lets users tack extra command-line flags onto
three of the four `barman-cloud-*` invocations: `barman-cloud-backup`
via
`data.additionalCommandArgs`, `barman-cloud-wal-archive` via
`wal.archiveAdditionalCommandArgs`, and `barman-cloud-wal-restore` via
`wal.restoreAdditionalCommandArgs`. The fourth — `barman-cloud-restore`,
the actual data-restore step in PITR and recovery-from-object-store —
has had no
equivalent, which is exactly the gap reported in #821 (the asker wanted
a longer `--read-timeout` for slow restores from S3).

This PR fills that gap by adding
`spec.configuration.data.restoreAdditionalCommandArgs` and wiring it
into the recovery job hook. In `restoreDataDir`,
the user-supplied flags are appended after the cloud-provider options
and `--endpoint-url` but before the positional `(destinationPath,
serverName,
backupID, pgdata)` arguments — same shape as the other three knobs. The
library's existing append/dedup logic still wins on conflicts, so users
can't
accidentally override flags the plugin already sets (`--cloud-provider`,
`--endpoint-url`, etc.).

Closes #821

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@gmail.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@gmail.com>
2026-06-03 14:17:12 +02:00
Leonardo Cecchi
aaf6120eaa
fix: classify WAL restore errors with precise gRPC statuses (#927)
Map each restorer sentinel to the gRPC status that best reflects whether
the operator should retry:

  - ErrWALNotFound      -> NotFound        (terminal)
  - ErrInvalidWalName   -> InvalidArgument (terminal)
  - ErrConnectivity     -> Unavailable     (retry)
  - ErrGeneric          -> Unavailable     (retry)
  - anything else       -> Internal        (terminal)

Previously every non-NotFound failure was returned verbatim, leaving the
operator unable to tell transient blips apart from terminal conditions
like a malformed WAL name.

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Tao Li <tao.li@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Tao Li <tao.li@enterprisedb.com>
2026-06-03 11:25:07 +02:00
renovate[bot]
58f4fed40b
fix(deps): update module sigs.k8s.io/controller-runtime to v0.24.0 (#880)
Some checks failed
Deploy Docusaurus to GitHub Pages / build (push) Failing after 4s
Deploy Docusaurus to GitHub Pages / deploy (push) Has been skipped
release-please / release-please (push) Failing after 3s
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@gmail.com>
2026-05-06 10:15:29 +02:00
renovate[bot]
a5717b1658
chore(deps): update golangci/golangci-lint docker tag to v2.12.0 (#881)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
|
[golangci/golangci-lint](https://redirect.github.com/golangci/golangci-lint)
| minor | `v2.11.4` → `v2.12.0` |

---

### Release Notes

<details>
<summary>golangci/golangci-lint (golangci/golangci-lint)</summary>

###
[`v2.12.0`](https://redirect.github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v2120)

[Compare
Source](https://redirect.github.com/golangci/golangci-lint/compare/v2.11.4...v2.12.0)

*Released on 2026-05-01*

1. New linters
- Add `clickhouselint` linter
<https://github.com/ClickHouse/clickhouse-go-linter>
2. Linters new features or changes
- `dupl`: from
[`f665c8d`](https://redirect.github.com/golangci/golangci-lint/commit/f665c8d69b32)
to
[`c99c5cf`](https://redirect.github.com/golangci/golangci-lint/commit/c99c5cf5c202)
(extended detection)
   - `funcorder`: from 0.5.0 to 0.6.0 (new option: `function`)
   - `goconst`: add an option to ignore strings from tests
   - `goconst`: from 1.8.2 to 1.10.0 (extended detection)
- `gomodguard_v2`: from 1.4.1 to 2.1.0 (major version with new
configuration)
- `gosec`: from
[`619ce21`](https://redirect.github.com/golangci/golangci-lint/commit/619ce2117e08)
to 2.26.1 (new checks: `G124`, `G708`, `G709`, `G710`)
   - `govet`: add `inline` analyzer
   - `makezero`: from 2.1.0 to 2.2.1 (support slice type aliases)
   - `paralleltest`: expose `checkcleanup` option
- `sloglint`: from 0.11.1 to 0.12.0 (new options: `allowed-keys`,
`custom-funcs`)
- `wsl_v5`: from 5.6.0 to 5.8.0 (new option: `cuddle-max-statements`;
new checks: `after-decl`, `after-defer`, `after-expr`, `after-go`,
`cuddle-group`)
3. Linters bug fixes
   - `forbidigo`: from 2.3.0 to 2.3.1
   - `godot`: from 1.5.4 to 1.5.6
   - `govet-modernize`: from 0.43.0 to 0.44.0
   - `ireturn`: from 0.4.0 to 0.4.1
- `rowserrcheck`: from 1.1.1 to
[`c5f79b8`](https://redirect.github.com/golangci/golangci-lint/commit/c5f79b8)
4. Misc.
   - Decrease cache entropy
   - Embed the JSON schema in the binary
- Filter env vars when cloning the repository with the `custom` command

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Never, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/cloudnative-pg/plugin-barman-cloud).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNTkuMiIsInVwZGF0ZWRJblZlciI6IjQzLjE1OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWF0ZWQiLCJuby1pc3N1ZSJdfQ==-->

---------

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@gmail.com>
2026-05-04 16:01:21 +02:00
Gabriele Fedi
4bbaf18cd3
feat: configure k8s recommended labels on subresources (#865)
Some checks failed
release-please / release-please (push) Failing after 5s
Add [Kubernetes recommended
labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/#labels)
to Role and RoleBinding managed Objects.

Closes #545

Signed-off-by: Gabriele Fedi <gabriele.fedi@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2026-04-29 14:35:43 +02:00
Peggie
e694dd8a3c
chore(main): release 0.12.0 (#756)
Some checks failed
release-please / release-please (push) Failing after 2s
🤖 I have created a release *beep* *boop*
---


##
[0.12.0](https://github.com/cloudnative-pg/plugin-barman-cloud/compare/v0.11.0...v0.12.0)
(2026-04-13)


### Features

* **deps:** Update dependency barman to v3.18.0
([#813](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/813))
([a8b446f](a8b446faa8))


### Bug Fixes

* **deps:** Update all non-major go dependencies
([#751](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/751))
([5001fe7](5001fe7831))
* **deps:** Update all non-major go dependencies
([#757](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/757))
([d031c23](d031c23532))
* **deps:** Update all non-major go dependencies
([#801](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/801))
([6ae101f](6ae101f016))
* **deps:** Update dependency @easyops-cn/docusaurus-search-local to
^0.55.0
([#753](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/753))
([60d32cc](60d32cca0c))
* **deps:** Update documentation dependencies
([#833](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/833))
([e1d4a6e](e1d4a6e5f7))
* **deps:** Update k8s.io/utils digest to 28399d8
([#829](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/829))
([3549e26](3549e2650a))
* **deps:** Update k8s.io/utils digest to b8788ab
([#784](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/784))
([f64ff8e](f64ff8e13f))
* **deps:** Update kubernetes packages to v0.35.2
([#788](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/788))
([a7e28f6](a7e28f6cad))
* **deps:** Update module github.com/cert-manager/cert-manager to
v1.19.3 [security]
([#775](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/775))
([79238f5](79238f5772))
* **deps:** Update module github.com/cert-manager/cert-manager to
v1.20.2
([#844](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/844))
([441f43b](441f43be24))
* **deps:** Update module github.com/cloudnative-pg/api to v1.29.0
([#837](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/837))
([09181b0](09181b0bda))
* **deps:** Update module github.com/cloudnative-pg/machinery to v0.4.0
([#850](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/850))
([18e3888](18e38887ce))
* **deps:** Update module google.golang.org/grpc to v1.79.3 [security]
([#819](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/819))
([376e178](376e178ab5))
* **deps:** Update module sigs.k8s.io/controller-runtime to v0.23.3
([#789](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/789))
([3f726ea](3f726ea83e))
* **deps:** Update module sigs.k8s.io/kustomize/api to v0.21.1
([#790](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/790))
([84a388e](84a388e5d7))
* **metrics:** Announce sidecar injection capability
([#776](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/776))
([4a94cb9](4a94cb9dae))
* **rbac:** Reconcile Role when ObjectStore spec changes
([#823](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/823))
([8971a39](8971a397f4))
* **restore:** Race condition in parallel WAL restore spool
([#812](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/812))
([25d72ce](25d72ce0a3))
* **restore:** Use custom CNPG group and version for scheme registration
([#847](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/847))
([b1f373d](b1f373d84b))
* **security:** Harden GitHub Actions workflows against expression
injection
([#773](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/773))
([ce7b761](ce7b7612ae))
* Skip maintenance cycle when plugin is not enabled for backups
([#826](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/826))
([63a67cb](63a67cb920)),
closes
[#774](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/774)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: Peggie <info@cloudnative-pg.io>
2026-04-14 09:31:41 +02:00
Armando Ruocco
8971a397f4
fix(rbac): reconcile Role when ObjectStore spec changes (#823)
When an ObjectStore's credentials change (e.g., secret rename), the
RBAC Role granting the Cluster's ServiceAccount access to those
secrets was not updated because nothing triggered a Cluster
reconciliation.

Implement the ObjectStore controller's Reconcile to detect affected
Roles and update their rules directly, without needing access to
Cluster objects. The controller lists Roles by a label set by the
Pre hook, inspects their rules to find which ObjectStores they
reference, fetches those ObjectStores, and patches the rules to
match the current specs.

Replace the custom setOwnerReference helper with
controllerutil.SetControllerReference. Add dynamic CNPG scheme
registration (internal/scheme) to the operator, instance, and
restore managers.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Gabriele Quaresima <gabriele.quaresima@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Gabriele Quaresima <gabriele.quaresima@enterprisedb.com>
2026-04-13 15:48:35 +02:00
Armando Ruocco
b1f373d84b
fix(restore): use custom CNPG group and version for scheme registration (#847)
The restore manager used a hardcoded scheme registration that ignored
CUSTOM_CNPG_GROUP and CUSTOM_CNPG_VERSION, causing restore jobs to fail
under non-standard CNPG API groups.

Extract `generateScheme()` into `common.GenerateScheme()` and use it
from both instance and restore managers.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-04-13 13:20:38 +02:00
Gabriele Fedi
63a67cb920
fix: skip maintenance cycle when plugin is not enabled for backups (#826)
Skip the catalog maintenance cycle when the plugin is not configured for
backups on the cluster, which happens when the plugin is used for
restore only.

Closes #774

Signed-off-by: Gabriele Fedi <gabriele.fedi@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-04-09 15:32:40 +02:00
Kenny Root
4a94cb9dae
fix(metrics): announce sidecar injection capability (#776)
Some checks failed
release-please / release-please (push) Failing after 5s
The operator was not announcing the TYPE_INSTANCE_SIDECAR_INJECTION
capability so the CNPG operator did not consider the plugin enabled
for instance pods. The instance manager never queried the plugin's
metrics endpoint, and the barman_cloud_cloudnative_pg_io_* metrics
were missing entirely.

This bug was masked when isWALArchiver was set to true in the plugin
configuration, because the backward compatibility code in CNPG would
mark the plugin as enabled as a side-effect. Users with isWALArchiver
set to false (or omitted) never saw the new metrics.

Closes #682 

Signed-off-by: Kenny Root <kenny@the-b.org>
2026-03-31 15:36:09 +02:00
Peggie
5cad545385
chore(main): release 0.11.0 (#717)
Some checks failed
Deploy Docusaurus to GitHub Pages / build (push) Failing after 3s
Deploy Docusaurus to GitHub Pages / deploy (push) Has been skipped
release-please / release-please (push) Failing after 2s
🤖 I have created a release *beep* *boop*
---


##
[0.11.0](https://github.com/cloudnative-pg/plugin-barman-cloud/compare/v0.10.0...v0.11.0)
(2026-01-30)


### Features

* Add support for DefaultAzureCredential authentication mechanism
([#681](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/681))
([2c134ea](2c134eafe4))
* **deps:** Update barman-cloud to v3.17.0
([#702](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/702))
([fa546ea](fa546eae05))


### Bug Fixes

* **azure:** Update barman-cloud with Azure validation fix
([#710](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/710))
([0153abb](0153abba82)),
closes
[#705](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/705)
* **deps:** Update all non-major go dependencies
([#719](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/719))
([4a637d7](4a637d7c58))
* **deps:** Update k8s.io/utils digest to 914a6e7
([#715](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/715))
([b3bcf6d](b3bcf6d9c1))
* **deps:** Update module sigs.k8s.io/controller-runtime to v0.23.1
([#748](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/748))
([71bd4d8](71bd4d808d))
* Resolve WAL archiving performance and memory issues
([#746](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/746))
([378c76a](378c76a526)),
closes
[#735](https://github.com/cloudnative-pg/plugin-barman-cloud/issues/735)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: Peggie <info@cloudnative-pg.io>
2026-01-30 16:32:12 +01:00
renovate[bot]
71bd4d808d
fix(deps): update module sigs.k8s.io/controller-runtime to v0.23.1 (#748)
Some checks failed
Deploy Docusaurus to GitHub Pages / build (push) Failing after 4s
Deploy Docusaurus to GitHub Pages / deploy (push) Has been skipped
release-please / release-please (push) Failing after 2s
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-01-29 19:39:06 +01:00
renovate[bot]
ad8a1767a7
chore(deps): update golangci/golangci-lint docker tag to v2.8.0 (#721)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-01-14 12:20:09 +01:00
Armando Ruocco
2c134eafe4
feat: add support for DefaultAzureCredential authentication mechanism (#681)
Some checks failed
Deploy Docusaurus to GitHub Pages / build (push) Failing after 2s
Deploy Docusaurus to GitHub Pages / deploy (push) Has been skipped
release-please / release-please (push) Failing after 1s
This commit adds support for the DefaultAzureCredential authentication
mechanism in Azure Blob Storage. Users can now use the
`useDefaultAzureCredentials` option to enable Azure's default credential
chain, which automatically discovers and uses available credentials in
the following order

1. Environment Variables (Service Principal)
2. Managed Identity
3. Azure CLI
4. Azure PowerShell

This is particularly useful when running on Azure Kubernetes Service
(AKS) with Workload Identity, eliminating the need to explicitly store
credentials in Kubernetes Secrets.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Gabriele Fedi <gabriele.fedi@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Gabriele Fedi <gabriele.fedi@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-01-08 14:58:27 +01:00
Peggie
1d7974516f
chore(main): release 0.10.0 (#668)
Some checks failed
release-please / release-please (push) Failing after 3s
Barman Base Image / build (push) Failing after 2s
Signed-off-by: Peggie <info@cloudnative-pg.io>
2025-12-30 16:24:03 +01:00
Armando Ruocco
921b20c249
feat: add pprof-server support (#538)
Some checks failed
Deploy Docusaurus to GitHub Pages / build (push) Failing after 5s
Deploy Docusaurus to GitHub Pages / deploy (push) Has been skipped
release-please / release-please (push) Failing after 2s
Barman Base Image / build (push) Failing after 6s
Closes #421

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
2025-11-26 17:54:34 +01:00
Andreas Mårtensson
a487c4ef50
fix: don't log full environment variables at default log level (#589)
Logging the full environment of the plugin container can potentially
result in an unnecessarily long log line, but perhaps more importantly
the credentials are visible as well.

Signed-off-by: Andreas Mårtensson <andreas.martensson@svt.se>
2025-11-21 10:15:34 +01:00
Peggie
316828cc73
chore(main): release 0.9.0 (#632)
Signed-off-by: Peggie <info@cloudnative-pg.io>
2025-11-06 14:02:38 +01:00
Peggie
b0f80519e7
chore(main): release 0.8.0 (#563)
Signed-off-by: Peggie <info@cloudnative-pg.io>
2025-10-27 19:07:05 +01:00
Armando Ruocco
49f1096cba
fix: set LeaderElectionReleaseOnCancel to true to enable RollingUpdates (#615)
Enable the LeaderElectionReleaseOnCancel option in the controller
manager to fix a deadlock issue during RollingUpdate deployments with
leader election enabled.

Without this setting, the old pod holds the leader lease during
shutdown, preventing the new pod from becoming ready. This creates a
deadlock where Kubernetes won't terminate the old pod because the new
pod isn't ready, and the new pod can't become ready because it can't
acquire the lease.

With LeaderElectionReleaseOnCancel enabled, the old pod voluntarily
releases the lease when it receives a shutdown signal, allowing the new
pod to acquire leadership immediately and become ready, enabling smooth
rolling updates.

Closes #419

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
2025-10-24 14:00:24 +02:00
Leonardo Cecchi
931a06a407
fix: disable management of end-of-wal file flag during backup restoration (#604)
When the end of the WAL stream is reached, the parallel WAL restore
feature attempts to predict the names of subsequent WAL files to restore
and records the first missing WAL file.

On high-availability (HA) replicas, if PostgreSQL requests the first
missing WAL file, the code returns an error status that prompts
PostgreSQL to switch to streaming replication.

Currently, the code assumes a `wal_segment_size` of 16MB for predicting
the next WAL file names. If the configured WAL segment size exceeds
16MB, it may request non-existent WAL files. For instance, with 16MB
segments, the names would range from `000000010000000100000000` to
`0000000100000001000000FF` before moving to the next segment. For 1GB
segments, they would range from `000000010000000100000000` to
`000000010000000100000003`.

With the assumption of a 16MB segment size, the code will not find the
WALs from `000000010000000100000004` to `0000000100000001000000FF`.

While this assumption does not affect HA replicas - which can shift to
streaming mode - it's problematic for a PostgreSQL instance seeking
consistency after a restore, as the restore process will fail.

This patch disables end-of-wal file marker management during
replication, addressing restore issues for backups that were:

1. using a custom WAL file segment size
2. utilizing parallel WAL recovery
3. initiated on one WAL segment and concluded on a different one

Fixes: #603

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-10-17 19:16:54 +02:00
Marco Nenciarini
1be34fe13e
feat(ip): assign copyright to the Linux Foundation (#571)
Adopt the new attribution information for contributions to
CloudNativePG:

```
Copyright © contributors to CloudNativePG, established as
CloudNativePG a Series of LF Projects, LLC.
```

Adopt the SPDX format for Apache License 2.0

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Co-authored-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-10-07 18:06:06 +02:00
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