open-telemetry / opentelemetry-operator

Kubernetes Operator for OpenTelemetry Collector
Apache License 2.0
1.21k stars 440 forks source link

Target Allocator doesn't accept only target_allocator config in the collector config #2998

Open jaronoff97 opened 5 months ago

jaronoff97 commented 5 months ago

Component(s)

target allocator

What happened?

Description

The target allocator is supposed to be able accept only the target_allocator configuration, but right now it errors when doing so.

Steps to Reproduce

Create a collector with the target_allocator section set:

prometheus:
        target_allocator:
          endpoint: xxxxxxx
          interval: 30s
          collector_id: ${POD_NAME}

Expected Result

Actual Result

{"level":"ERROR","timestamp":"2024-05-29T17:17:58Z","logger":"controllers.OpenTelemetryCollector","message":"Failed to create manifest.Params","opentelemetrycollector":{"name":"colossus-us-sjc45-prd-mon1","namespace":"platform-engineering-resources"},"error":"no prometheusConfig available as part of the configuration","stacktrace":"[github.com/open-telemetry/opentelemetry-operator/controllers.(*OpenTelemetryCollectorReconciler).Reconcile](http://github.com/open-telemetry/opentelemetry-operator/controllers.(*OpenTelemetryCollectorReconciler).Reconcile)\n\t/home/runner/work/opentelemetry-operator/opentelemetry-operator/controllers/opentelemetrycollector_controller.go:236\[nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile](http://nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile)\n\t/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:119\[nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler](http://nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler)\n\t/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:316\[nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem](http://nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem)\n\t/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:266\[nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2](http://nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2)\n\t/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:227"}

Kubernetes Version

1.29.0

Operator version

0.100.1

Collector version

0.101.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04") Compiler(if manually compiled): (e.g., "go 14.2")

Log output

No response

Additional context

No response

jaronoff97 commented 5 months ago

it would also be great if the target-allocators per-node strategy said which job was lacking the node metadata info for the per-node strategy!

parambath92 commented 4 months ago

Hi @jaronoff97, I would like work on this issue. Can you please assign this to me ?

jaronoff97 commented 4 months ago

@parambath92 sure! let me know if you need any assistance in getting started!

yingsamsung commented 2 months ago

@parambath92 do you have an ETA on when you can get this done? I'd like to be able to override the default target allocator endpoint with "target_allocator" config in prometheus receiver.

parambath92 commented 2 months ago

Hi @yingsamsung , I can work on it this weekend and update here.

yingsamsung commented 2 months ago

Thank you so much. @parambath92

Just want to clarify, with your fix, I can override the default target_allocator.endpoint, hardcoded at here , right? Do you happen to know if there is any other way to set my own target allocator endpoint to, for example: otel-collector-targetallocator.my-namespace.svc.my-region.my-environment.cluster.local?

jaronoff97 commented 2 months ago

@yingsamsung i believe your issue is covered in #3242. This issue is in relation to not being able to set solely a target allocator configuration.