Skip to content

fix(kube-stack): inject prometheus receiver when targetAllocator is enabled without scrape_configs_file - #2211

Merged
TylerHelmuth merged 8 commits into
open-telemetry:mainfrom
cyrille-leclerc:fix/kube-stack-targetallocator-prometheus-receiver
May 22, 2026
Merged

fix(kube-stack): inject prometheus receiver when targetAllocator is enabled without scrape_configs_file#2211
TylerHelmuth merged 8 commits into
open-telemetry:mainfrom
cyrille-leclerc:fix/kube-stack-targetallocator-prometheus-receiver

Conversation

@cyrille-leclerc

Copy link
Copy Markdown
Member

Summary

Fixes #2210.

When scrape_configs_file is empty and targetAllocator.enabled: true, the OpenTelemetry Operator expects a prometheus receiver in the collector config so it can patch in the target_allocator endpoint. Without it, reconciliation fails with:

no prometheus available as part of the configuration

This change updates _config.tpl to, when targetAllocator is enabled and no scrape_configs_file is supplied:

  1. Inject a minimal prometheus receiver (with an empty scrape_configs list) if the user hasn't already defined one — giving the operator something to patch.
  2. Append prometheus to service.pipelines.metrics.receivers (when a metrics pipeline exists and it isn't already listed) so the metrics scraped via the target allocator actually flow through the collector pipeline.

A new example daemonset-ta-no-scrape-config-file reproduces the configuration from the issue and demonstrates the fix.

Test plan

  • helm template of the new example produces a collector with receivers.prometheus.config.scrape_configs: [] and service.pipelines.metrics.receivers containing prometheus
  • make generate-examples CHARTS=opentelemetry-kube-stack regenerated all example outputs
  • Chart version bumped from 0.15.0 to 0.15.1
  • CI lint/install passes

…led without scrape_configs_file

When `scrape_configs_file` is empty and `targetAllocator.enabled: true`,
the OpenTelemetry Operator expects a `prometheus` receiver in the
collector config so it can patch in the `target_allocator` endpoint.
Without it, reconciliation fails with:
  "no prometheus available as part of the configuration"

This change injects a minimal prometheus receiver (empty scrape_configs)
when one isn't already defined, and appends `prometheus` to the metrics
pipeline receivers so target-allocator scraped metrics flow through.

Fixes open-telemetry#2210
@cyrille-leclerc
cyrille-leclerc requested review from a team and jaronoff97 as code owners May 20, 2026 11:22
Without {{- ... -}} trim markers, comments leave blank lines in the
generated collector spec.config when rendered with plain helm template
(the --output-dir mode used by make generate-examples already strips
them, which is why the checked-in rendered examples don't show the
issue).
Comment thread charts/opentelemetry-kube-stack/templates/_config.tpl Outdated
@TylerHelmuth

Copy link
Copy Markdown
Member

@cyrille-leclerc can you add a test to the ci folder for this bug

@cyrille-leclerc

cyrille-leclerc commented May 22, 2026

Copy link
Copy Markdown
Member Author

Ci test added

@TylerHelmuth

Copy link
Copy Markdown
Member

Need #2219 first

@TylerHelmuth
TylerHelmuth merged commit a646beb into open-telemetry:main May 22, 2026
8 checks passed
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.

[kube-stack] OTel Operator error msg no prometheus available as part of the configuration

2 participants