Skip to content

feat(targetallocator): Expose missing Prometheus CR fields#4767

Open
alex5517 wants to merge 6 commits intoopen-telemetry:mainfrom
alex5517:feat/ta-prom-cr-fields
Open

feat(targetallocator): Expose missing Prometheus CR fields#4767
alex5517 wants to merge 6 commits intoopen-telemetry:mainfrom
alex5517:feat/ta-prom-cr-fields

Conversation

@alex5517
Copy link

@alex5517 alex5517 commented Feb 24, 2026

Description:

This PR adds several missing fields to the prometheusCR configuration within the TargetAllocator and OpenTelemetryCollector APIs (v1beta1).

Currently, the underlying Target Allocator binary supports these Prometheus Custom Resource specifications, but they were not exposed via the Operator's API. This change achieves feature parity by exposing the following fields:

  • evaluationInterval
  • scrapeProtocols
  • podMonitorNamespaceSelector
  • serviceMonitorNamespaceSelector
  • scrapeConfigNamespaceSelector
  • probeNamespaceSelector

Link to tracking Issue(s): N/A

Testing:

  • Expanded existing Chainsaw E2E tests in tests/e2e-targetallocator/targetallocator-prometheuscr (02-install.yaml and 02-assert.yaml) to deploy a v1beta1 Collector with all new fields populated, asserting that they correctly serialize into the resulting targetallocator.yaml ConfigMap payload.
  • Ran make test locally to ensure all tests pass.

Documentation:

  • Added descriptive Go comments to all newly introduced fields.
  • Ran make update to automatically regenerate docs/api/opentelemetrycollectors.md and docs/api/targetallocators.md.
  • Generated a .chloggen YAML entry for the release notes.

Signed-off-by: Alexander Soelberg Heidarsson <89837986+alex5517@users.noreply.github.com>
@alex5517 alex5517 requested a review from a team as a code owner February 24, 2026 09:49
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 24, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: alex5517 / name: Alexander Soelberg Heidarsson (bb315ad, d11324f)

Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

Thank you for taking this up! We don't want to make changes to the v1alpha1 CR, so you can just drop those and the conversion logic.

You can link against the following issue in your changelog entry: #1934.

Signed-off-by: Alexander Soelberg Heidarsson <89837986+alex5517@users.noreply.github.com>
@alex5517
Copy link
Author

@swiatekm, Thanks i have added #1934 to the changelog, and removed the changes to the v1alpha1 CR.

I also noticed that there was another PR for this: #3573 - This PR should close that one.

@alex5517 alex5517 requested a review from swiatekm February 24, 2026 15:15
@swiatekm
Copy link
Contributor

@swiatekm, Thanks i have added #1934 to the changelog, and removed the changes to the v1alpha1 CR.

I also noticed that there was another PR for this: #3573 - This PR should close that one.

I haven't fully reviewed your PR, but you should take note of the conversation here: #3573 (comment) and ensure you're setting the right defaults for selectors to avoid breaking changes.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2026

E2E Test Results

 34 files  ±0  227 suites  ±0   2h 16m 0s ⏱️ + 8m 53s
 90 tests ±0   89 ✅  - 1  0 💤 ±0  1 ❌ +1 
231 runs  ±0  229 ✅  - 2  0 💤 ±0  2 ❌ +2 

For more details on these failures, see this check.

Results for commit 100ee8a. ± Comparison against base commit b277e27.

♻️ This comment has been updated with latest results.

Signed-off-by: Alexander Soelberg Heidarsson <89837986+alex5517@users.noreply.github.com>
@alex5517
Copy link
Author

@swiatekm,

Ah thanks for pointing that out.

I have updated the PR to add the +kubebuilder:default:={} marker to all the namespace selectors.
I also updated the unit tests, and added a new e2e step that verifies the behavior.

Signed-off-by: Alexander Soelberg Heidarsson <89837986+alex5517@users.noreply.github.com>
@alex5517
Copy link
Author

alex5517 commented Feb 25, 2026

@swiatekm,

e2e tests are fixed (works on my machine) - I realized I had an oversight with how step-02 was handling the new selectors, so I reorganized things a bit. Step-02 now verify the default empty selectors, and step-03 tests the actual namespace selector logic for scrape configs.

Signed-off-by: Alexander Soelberg Heidarsson <89837986+alex5517@users.noreply.github.com>
@alex5517
Copy link
Author

@swiatekm - Sorry about that, missed the e2e-targetallocator-cr only tested e2e-targetallocator locally...

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.

2 participants