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
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