Skip to content

fix(annotations): remove prometheus annotations when DisablePrometheusAnnotations is true#5234

Closed
AruneshDwivedi wants to merge 1 commit into
open-telemetry:mainfrom
AruneshDwivedi:fix/disable-prometheus-annotations-removal
Closed

fix(annotations): remove prometheus annotations when DisablePrometheusAnnotations is true#5234
AruneshDwivedi wants to merge 1 commit into
open-telemetry:mainfrom
AruneshDwivedi:fix/disable-prometheus-annotations-removal

Conversation

@AruneshDwivedi

Copy link
Copy Markdown

When DisablePrometheusAnnotations was set to true after initial creation, the operator would not remove existing prometheus pod annotations (prometheus.io/scrape, prometheus.io/port, prometheus.io/path).

The PodAnnotations function only handled the additive path. When the flag was true, it simply skipped adding annotations but never removed ones already present from a previous state.

Fix: when DisablePrometheusAnnotations is true, explicitly delete the known prometheus annotation keys from the pod annotations map.

Also fixed the comment that incorrectly said 'nil or true' instead of 'nil or false'. Added test case for the disable-after-create transition.

Fixes #5043

…sAnnotations is true

When DisablePrometheusAnnotations was set to true after initial creation,
the operator would not remove existing prometheus pod annotations
(prometheus.io/scrape, prometheus.io/port, prometheus.io/path).

The PodAnnotations function only handled the additive path. When the flag
was true, it simply skipped adding annotations but never removed ones that
were already present from a previous state.

Fix: when DisablePrometheusAnnotations is true, explicitly delete the
known prometheus annotation keys from the pod annotations map.

Also fixed the comment that incorrectly said 'nil or true' instead of
'nil or false'. Added test case for the disable-after-create transition.

Fixes open-telemetry#5043

Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
@AruneshDwivedi AruneshDwivedi requested a review from a team as a code owner June 21, 2026 05:16
@swiatekm

Copy link
Copy Markdown
Contributor

This looks like a duplicate of #5069. As you can see in that PR, this is unfortunately a deeper hole than initially expected, but we're close to resolving it.

@AruneshDwivedi

Copy link
Copy Markdown
Author

Closing as duplicate of #5069 which already addresses this. Thanks @swiatekm for flagging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

disablePrometheusAnnotations does not remove annotations

2 participants