opentelemetry-operator
opentelemetry-operator copied to clipboard
Add serviceName Field to OpenTelemetryCollector CRD for StatefulSet Deployments
Description: Add support for custom service names in StatefulSet headless services
This PR fixes the handling of service names for StatefulSet mode in the OpenTelemetry Collector operator:
- Adds ability to specify custom service names via
spec.serviceNamefield for sts - When running in StatefulSet mode and no service name is specified, defaults to
<name>-headless - Maintains existing behavior for non-StatefulSet modes
- Ensures TLS secret names follow the service naming pattern
Link to tracking Issue(s): 4029
Testing:
Added new test cases in statefulset_test.go for statefulset creation with custom and default service names:
- Test default headless service name generation for StatefulSet mode
- Test custom service name handling for sts
Documentation:
Could you please add assert here https://github.com/open-telemetry/opentelemetry-operator/blob/6d2f18b0ac0303aff2b904c2de76296cea60fbf9/tests/e2e/smoke-statefulset/00-assert.yaml
Could you please add assert here https://github.com/open-telemetry/opentelemetry-operator/blob/6d2f18b0ac0303aff2b904c2de76296cea60fbf9/tests/e2e/smoke-statefulset/00-assert.yaml
@pavolloffay I have added them
@pavolloffay @iblancasa requesting for workflow approvals and reviews
@vignesh-codes running make update should fix the CI failure.
I imagined this feature working a bit differently. Rather than letting the user rename the Service (which in and out of itself isn't that useful), it should let them provide the name of a Service they created themselves. This how setting
serviceAccountcurrently works, but we can always create the headless Service regardless. @open-telemetry/operator-approvers what do you think we should do here?I don't have any complaints about the fix setting the default as the headless Service, so maybe we can make that a separate PR?
Cool! i made the make update command and pushed the commit. Let me know
this is my current working config from the collector helm chart
nameOverride: "dev-opentelemetry-backend-collector"
fullnameOverride: "dev-opentelemetry-backend-collector-headless"
here is how the collector chart currently functions https://github.com/open-telemetry/opentelemetry-helm-charts/blob/09a02cb2dc1fe2c0e7e0ee51c2fe9c6a95ddc807/charts/opentelemetry-collector/templates/statefulset.yaml#L16
It'd be nice for a similar option with the OpenTelemetryCollector CR when mode: statefulset
this is my current working config from the collector helm chart
nameOverride: "dev-opentelemetry-backend-collector" fullnameOverride: "dev-opentelemetry-backend-collector-headless"here is how the collector chart currently functions https://github.com/open-telemetry/opentelemetry-helm-charts/blob/09a02cb2dc1fe2c0e7e0ee51c2fe9c6a95ddc807/charts/opentelemetry-collector/templates/statefulset.yaml#L16
It'd be nice for a similar option with the OpenTelemetryCollector CR when
mode: statefulset
That's already how it functions. The Service name is based on the OpenTelemetryCollector's metadata.name.
@vignesh-codes looks good to me now! Could you resolve the lint failure? Then we should be good to merge.
@iblancasa Waiting for your review and approval. Thanks