Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change TargetAllocator configmap for ScrapeConfig and Probe CR #3469

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dominicqi
Copy link
Contributor

@dominicqi dominicqi commented Nov 18, 2024

Description: Enable ScrapeConfigSelector and ProbeSelector support in OpenTelemetryTargetAllocatorPrometheusCR, create right configmap for target allocator

Link to tracking Issue(s):

Testing: add test in configmap_test.go

Documentation: ScrapeConfigSelector and ProbeSelector config in v1beta1 api doc

@dominicqi dominicqi requested a review from a team as a code owner November 18, 2024 06:07
Copy link

linux-foundation-easycla bot commented Nov 18, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@dominicqi dominicqi force-pushed the scrape_config_probe_selector branch 7 times, most recently from cc3c041 to 97b4885 Compare November 18, 2024 07:40
@dominicqi dominicqi changed the title Add TargetAllocator config for ScrapeConfig and Probe CR Change TargetAllocator configmap for ScrapeConfig and Probe CR Nov 18, 2024
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.

Looks good overall, some relatively minor nitpicks aside. Could you also add an e2e test for this behaviour? You can probably modify https://github.com/open-telemetry/opentelemetry-operator/tree/main/tests/e2e-targetallocator/targetallocator-prometheuscr.

Makefile Outdated Show resolved Hide resolved
apis/v1alpha1/opentelemetrycollector_types.go Outdated Show resolved Hide resolved
apis/v1beta1/targetallocator_types.go Outdated Show resolved Hide resolved
apis/v1beta1/targetallocator_types.go Outdated Show resolved Hide resolved
@dominicqi dominicqi force-pushed the scrape_config_probe_selector branch 2 times, most recently from 53614ed to d673153 Compare November 18, 2024 11:57
…TargetAllocatorPrometheusCR, create right configmap for target allocator

Signed-off-by: qiyang <[email protected]>
@dominicqi
Copy link
Contributor Author

Looks good overall, some relatively minor nitpicks aside. Could you also add an e2e test for this behaviour? You can probably modify https://github.com/open-telemetry/opentelemetry-operator/tree/main/tests/e2e-targetallocator/targetallocator-prometheuscr.

I'm not very familiar with E2E testing yet. I will take some time to look into it.

@dominicqi dominicqi force-pushed the scrape_config_probe_selector branch 3 times, most recently from d3861c1 to 4960f02 Compare November 19, 2024 07:58
@dominicqi
Copy link
Contributor Author

@swiatekm e2e test added

@swiatekm
Copy link
Contributor

@swiatekm e2e test added

Thanks for adding it! What you've added checks that setting the attribute on the CR leads to a change in the target allocator ConfgMap, which is a part of it. But since this PR effectively exposes this functionality to users, I'd like the new e2e test to also check that we actually allocate targets derived from ScrapeConfigs and Probes.

What I'd like you to add is the following:

  • Create a ScrapeConfig and/or Probe targetting the Otel collector you create in the test
  • Set the selector to select that ScrapeConfig/Probe
  • Use Jobs similar to the existing test to verify that the target allocator is actually allocating targets generated for the ScrapeConfig/Probe

Does that make sense?

For the record, the rest of your PR looks good to me.

@jaronoff97
Copy link
Contributor

@dominicqi thanks for adding this :D I was planning on doing this when I got back from PTO but glad to see this is already here 🥳 With the changes that Mikolaj mentioned above this should be g2g.

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.

[target allocator] Support the Probe and ScrapeConfig Prometheus Operator CRDs
3 participants