fix(kube-stack): inject prometheus receiver when targetAllocator is enabled without scrape_configs_file - #2211
Merged
TylerHelmuth merged 8 commits intoMay 22, 2026
Conversation
…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
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).
TylerHelmuth
approved these changes
May 21, 2026
Member
|
@cyrille-leclerc can you add a test to the |
Member
Author
|
Ci test added |
Member
|
Need #2219 first |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2210.
When
scrape_configs_fileis empty andtargetAllocator.enabled: true, the OpenTelemetry Operator expects aprometheusreceiver in the collector config so it can patch in thetarget_allocatorendpoint. Without it, reconciliation fails with:This change updates
_config.tplto, whentargetAllocatoris enabled and noscrape_configs_fileis supplied:prometheusreceiver (with an emptyscrape_configslist) if the user hasn't already defined one — giving the operator something to patch.prometheustoservice.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-filereproduces the configuration from the issue and demonstrates the fix.Test plan
helm templateof the new example produces a collector withreceivers.prometheus.config.scrape_configs: []andservice.pipelines.metrics.receiverscontainingprometheusmake generate-examples CHARTS=opentelemetry-kube-stackregenerated all example outputs0.15.0to0.15.1