Skip to content

Conversation

@mikel-jason
Copy link

Description:

  • Propagate annotations of the OTelCol and TA custom resources to the TA deployment resource. Note: This is not about pod annotations.
  • Refactor: Rename the annotation function so it's similar to the ones for the OTelCol. To me it was quite confusing to see that the TA func is called Annotations but means PodAnnotations. I just renamed it without any further change for backwards compatibility. Yet it would be debatable if it's the pod annotation which should be put on the pdb and netpol. That's a different topic though.

Resolves: #4393

Testing:

  • I didn't manage to get the tests running on my machine (envsetup failed). go test ./internal/manifests/... succeeds. As the changes are limited to that package, I guessed it's enough to raise the PR and see the checks in the CI pipelines.
  • Tested the functionality manually in a kind cluster

Documentation: None

@mikel-jason mikel-jason requested a review from a team as a code owner October 2, 2025 08:27
@mikel-jason mikel-jason changed the title Feat/target allocator deployment annotations Propagate annotations of the OTelCol and TA custom resources to the TA deployment resource Oct 2, 2025
@pavolloffay
Copy link
Member

Do you mind changing an existing e2e test and add an annotation?

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2025

E2E Test Results

 34 files  ±0  221 suites  ±0   1h 59m 46s ⏱️ - 17m 34s
 88 tests ±0   88 ✅ ±0  0 💤 ±0  0 ❌ ±0 
225 runs  ±0  225 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 1bb74b0. ± Comparison against base commit b9dcedc.

♻️ This comment has been updated with latest results.

@mikel-jason
Copy link
Author

Sure, I'll take a look next week once I'm back in the office

@mikel-jason mikel-jason force-pushed the feat/target-allocator-deployment-annotations branch from 0f9c881 to 6301ee7 Compare October 13, 2025 12:37
@mikel-jason
Copy link
Author

Added to E2E tests (both OTelCol and TA CR). The E2E test failed in the run before (targetallocator-metrics) was a time-out, succeeds when running locally (same k8s version)

E2E test report files from running locally

e2e-targetallocator.xml

<testsuites name="chainsaw-report" time="122.310130" tests="5">
  <testsuite name="tests/e2e-targetallocator/targetallocator-metrics" tests="1" failures="0" errors="0" id="0" time="">
    <testcase name="targetallocator-metrics" classname="" time="19.465504"></testcase>
  </testsuite>
  <testsuite name="tests/e2e-targetallocator/targetallocator-features" tests="1" failures="0" errors="0" id="0" time="">
    <testcase name="targetallocator-features" classname="" time="58.856568"></testcase>
  </testsuite>
  <testsuite name="tests/e2e-targetallocator/targetallocator-namespace" tests="1" failures="0" errors="0" id="0" time="">
    <testcase name="targetallocator-namespace" classname="" time="62.172559"></testcase>
  </testsuite>
  <testsuite name="tests/e2e-targetallocator/targetallocator-prometheuscr" tests="1" failures="0" errors="0" id="0" time="">
    <testcase name="targetallocator-prometheuscr" classname="" time="84.477224"></testcase>
  </testsuite>
  <testsuite name="tests/e2e-targetallocator/targetallocator-kubernetessd" tests="1" failures="0" errors="0" id="0" time="">
    <testcase name="targetallocator-kubernetessd" classname="" time="90.068652"></testcase>
  </testsuite>
</testsuites>

e2e-targetallocator-cr.xml

<testsuites name="chainsaw-report" time="9.713641" tests="2">
  <testsuite name="tests/e2e-targetallocator-cr/targetallocator-label" tests="1" failures="0" errors="0" id="0" time="">
    <testcase name="targetallocator-label" classname="" time="1.035330"></testcase>
  </testsuite>
  <testsuite name="./tests/e2e-targetallocator-cr" tests="1" failures="0" errors="0" id="0" time="">
    <testcase name="targetallocator-cr" classname="" time="4.327177"></testcase>
  </testsuite>
</testsuites>

https://github.com/open-telemetry/opentelemetry-operator/actions/runs/18187651149/job/52051597858#step:8:213

I kindly request you to review again. Thanks in advance!

@mikel-jason mikel-jason force-pushed the feat/target-allocator-deployment-annotations branch from 6301ee7 to 1bb74b0 Compare October 22, 2025 04:00
@pavolloffay
Copy link
Member

@swiatekm could you please review as well?

@swiatekm
Copy link
Contributor

Looks like you have some test failures @mikel-jason, can you have a look?

@mikel-jason mikel-jason force-pushed the feat/target-allocator-deployment-annotations branch from 1bb74b0 to a76c8eb Compare October 22, 2025 13:03
@mikel-jason
Copy link
Author

Solved and rebased.

DONE 1849 tests, 3 skipped in 116.096s

FYI I found out I can run the tests with make test while go test as explained in the contrib guide gives me some /tmp/.../tls.crt no such file or directory error

### Unit tests
Some unit tests use [envtest](https://book.kubebuilder.io/reference/envtest.html) which requires Kubernetes binaries (e.g. `api-server`, `etcd` and `kubectl`) to be present on the host filesystem. Makefile takes care of installing all dependent binaries, however running the tests from IDE or via `go test` might not work out-of-the-box. The `envtest` uses env variable `KUBEBUILDER_ASSETS` that points to a directory with these binaries. To make the test work in IDE or `go test` the environment variable has to be correctly set.
Example how to run test that use `envtest`:
```bash
make envtest
KUBEBUILDER_ASSETS=$(./bin/setup-envtest use -p path 1.23) go test ./pkg...
```

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.

Propagate annotations to target allocator deployment

3 participants