Skip to content

fix(metrics): announce sidecar injection capability#776

Merged
mnencia merged 1 commit intocloudnative-pg:mainfrom
kruton:injection-bug
Mar 31, 2026
Merged

fix(metrics): announce sidecar injection capability#776
mnencia merged 1 commit intocloudnative-pg:mainfrom
kruton:injection-bug

Conversation

@kruton
Copy link
Copy Markdown
Contributor

@kruton kruton commented Mar 5, 2026

The operator was not announcing the TYPE_INSTANCE_SIDECAR_INJECTION capability, so the CNPG operator did not consider the plugin enabled for instance pods. As a result, the instance manager never queried the plugin's metrics endpoint, and the new 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: false (or omitted) never saw the new metrics.

The fix adds TYPE_INSTANCE_SIDECAR_INJECTION to GetPluginCapabilities(), which is already backed by the existing OperatorLifecycleServer implementation that handles pod mutation and sidecar injection via lifecycle hooks.

Fixes #682

@kruton kruton requested a review from a team as a code owner March 5, 2026 22:37
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Mar 5, 2026
@kruton kruton force-pushed the injection-bug branch 2 times, most recently from 21b45e9 to c433889 Compare March 6, 2026 17:17
Copy link
Copy Markdown
Contributor

@GabriFedi97 GabriFedi97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@armru
Copy link
Copy Markdown
Member

armru commented Mar 30, 2026

proposed commit:

fix(identity): add sidecar injection capability to operator

The operator plugin was not advertising the TYPE_INSTANCE_SIDECAR_INJECTION
capability, which prevented the CNPG operator from recognizing this plugin
as a sidecar injection provider.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Mar 30, 2026
@mnencia mnencia changed the title fix(metrics): add injection type to operator fix(metrics): announce sidecar injection capability Mar 31, 2026
The operator was not announcing the TYPE_INSTANCE_SIDECAR_INJECTION
capability so the CNPG operator was not considering the plugin enabled.
However, this bug was masked if you had set `isWALArchiver` to `true`
in your config, the backward compatibility code was marking the plugin
as enabled as a side-effect.

Signed-off-by: Kenny Root <kenny@the-b.org>
Copy link
Copy Markdown
Member

@mnencia mnencia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix correctly adds TYPE_INSTANCE_SIDECAR_INJECTION to the advertised plugin capabilities. This is backed by the existing OperatorLifecycleServer implementation which already handles pod mutation and sidecar injection via lifecycle hooks. The missing capability was preventing the CNPG operator from considering the plugin enabled, which in turn broke metrics collection for users with isWALArchiver: false.

@mnencia mnencia merged commit 4a94cb9 into cloudnative-pg:main Mar 31, 2026
3 of 4 checks passed
@kruton kruton deleted the injection-bug branch March 31, 2026 15:00
mnencia pushed a commit that referenced this pull request Apr 14, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.12.0](v0.11.0...v0.12.0)
(2026-04-13)


### Features

* **deps:** Update dependency barman to v3.18.0
([#813](#813))
([a8b446f](a8b446f))


### Bug Fixes

* **deps:** Update all non-major go dependencies
([#751](#751))
([5001fe7](5001fe7))
* **deps:** Update all non-major go dependencies
([#757](#757))
([d031c23](d031c23))
* **deps:** Update all non-major go dependencies
([#801](#801))
([6ae101f](6ae101f))
* **deps:** Update dependency @easyops-cn/docusaurus-search-local to
^0.55.0
([#753](#753))
([60d32cc](60d32cc))
* **deps:** Update documentation dependencies
([#833](#833))
([e1d4a6e](e1d4a6e))
* **deps:** Update k8s.io/utils digest to 28399d8
([#829](#829))
([3549e26](3549e26))
* **deps:** Update k8s.io/utils digest to b8788ab
([#784](#784))
([f64ff8e](f64ff8e))
* **deps:** Update kubernetes packages to v0.35.2
([#788](#788))
([a7e28f6](a7e28f6))
* **deps:** Update module github.com/cert-manager/cert-manager to
v1.19.3 [security]
([#775](#775))
([79238f5](79238f5))
* **deps:** Update module github.com/cert-manager/cert-manager to
v1.20.2
([#844](#844))
([441f43b](441f43b))
* **deps:** Update module github.com/cloudnative-pg/api to v1.29.0
([#837](#837))
([09181b0](09181b0))
* **deps:** Update module github.com/cloudnative-pg/machinery to v0.4.0
([#850](#850))
([18e3888](18e3888))
* **deps:** Update module google.golang.org/grpc to v1.79.3 [security]
([#819](#819))
([376e178](376e178))
* **deps:** Update module sigs.k8s.io/controller-runtime to v0.23.3
([#789](#789))
([3f726ea](3f726ea))
* **deps:** Update module sigs.k8s.io/kustomize/api to v0.21.1
([#790](#790))
([84a388e](84a388e))
* **metrics:** Announce sidecar injection capability
([#776](#776))
([4a94cb9](4a94cb9))
* **rbac:** Reconcile Role when ObjectStore spec changes
([#823](#823))
([8971a39](8971a39))
* **restore:** Race condition in parallel WAL restore spool
([#812](#812))
([25d72ce](25d72ce))
* **restore:** Use custom CNPG group and version for scheme registration
([#847](#847))
([b1f373d](b1f373d))
* **security:** Harden GitHub Actions workflows against expression
injection
([#773](#773))
([ce7b761](ce7b761))
* Skip maintenance cycle when plugin is not enabled for backups
([#826](#826))
([63a67cb](63a67cb)),
closes
[#774](#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>
renovate Bot added a commit to sdwilsh/ansible-playbooks that referenced this pull request Apr 16, 2026
…v0.12.0

##### [\`v0.12.0\`](https://github.com/cloudnative-pg/plugin-barman-cloud/releases/tag/v0.12.0)

##### Features

- **deps:** Update dependency barman to v3.18.0 ([#813](cloudnative-pg/plugin-barman-cloud#813)) ([a8b446f](cloudnative-pg/plugin-barman-cloud@a8b446f))

##### Bug Fixes

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

##### [\`v0.12.0\`](https://github.com/cloudnative-pg/plugin-barman-cloud/releases/tag/v0.12.0)

##### Features

- **deps:** Update dependency barman to v3.18.0 ([#813](cloudnative-pg/plugin-barman-cloud#813)) ([a8b446f](cloudnative-pg/plugin-barman-cloud@a8b446f))

##### Bug Fixes

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

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New observability metrics are not available

4 participants