Skip to content

feat: Introduce Command Arg to Collector Operator#4973

Open
blewis12 wants to merge 14 commits into
open-telemetry:mainfrom
blewis12:introduce-command-arg-to-collector-operator
Open

feat: Introduce Command Arg to Collector Operator#4973
blewis12 wants to merge 14 commits into
open-telemetry:mainfrom
blewis12:introduce-command-arg-to-collector-operator

Conversation

@blewis12
Copy link
Copy Markdown

@blewis12 blewis12 commented Apr 17, 2026

Description:
Addresses this feature request - and implements the ability to configure the collector entry point from the operator. Previously, it was only possible to set the args that were passed through and the command would fall back to the default (ie whatever is defined as the entry point in the docker image). This PR allows a user to set arguments like:

spec:
  command:
    - "/path/to/agent"
    - "otel"

Which would set the entry point/command as /path/to/agent otel - currently the helm chart offers the same capability

Testing:
internal/webhook/collector_webhook_test.go => tests the validating webhook’s create path
apis/v1alpha1/convert_test.go => tests that converting from v1beta1 to v1alpha1 and vice versa works as expected
internal/manifests/collector/container_test.go=> tests manifest generation

Documentation:
New spec.command / CollectorCommand fields in the Go types (v1beta1 and v1alpha1, including kubebuilder markers for CRD validation) - opentelemetrycollectors.md includes generated docs from that (if there's somewhere else to include docs please let me know!)

@blewis12 blewis12 requested a review from a team as a code owner April 17, 2026 14:40
@swiatekm
Copy link
Copy Markdown
Contributor

Why are you making this a struct instead of just keeping Command as a slice, the same as a Pod spec?

CC @open-telemetry/operator-approvers I vaguely recall there was a reason we didn't allow this to be changed, am I misremembering?

@blewis12
Copy link
Copy Markdown
Author

blewis12 commented Apr 22, 2026

thanks for taking a look @swiatekm - I used a struct here because I was emulating the structure that exists in the helm chart so thought it made sense for it to look similar on the operator level - do you think it makes more sense to have it be a slice instead?

i'm also curious if there were reasons this wasn't implemented before, since the related issue has been open for a while and has some upvotes

@blewis12
Copy link
Copy Markdown
Author

blewis12 commented Apr 22, 2026

ah, though I modeled this after the upstream helm chart with the struct - it probably doesn't make sense here as the operators already defines args (which the helm chart doesn't) so there's overlap with command.extraArgs there. A slice might be conceptually better and also aligns with the pod spec

Comment thread internal/manifests/collector/container.go Outdated
Comment thread internal/webhook/collector_webhook.go Outdated
Comment thread apis/v1alpha1/opentelemetrycollector_types.go Outdated
@blewis12 blewis12 force-pushed the introduce-command-arg-to-collector-operator branch from 98a2cda to dda9391 Compare May 14, 2026 11:00
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

E2E Test Results

 38 files  261 suites   2h 16m 9s ⏱️
110 tests 108 ✅ 2 💤 0 ❌
283 runs  277 ✅ 6 💤 0 ❌

Results for commit c27d8ca.

♻️ This comment has been updated with latest results.

@blewis12
Copy link
Copy Markdown
Author

hm, the e2e tests that failed here seem unrelated to this PR and pass locally 🤔 could be flaky?

@swiatekm swiatekm requested review from pavolloffay and swiatekm May 19, 2026 17:13
swiatekm
swiatekm approved these changes May 19, 2026
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.

3 participants