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

OpenTelemetryCollector v1beta1, nulls get dropped #3543

Open
NickLarsenNZ opened this issue Dec 12, 2024 · 3 comments
Open

OpenTelemetryCollector v1beta1, nulls get dropped #3543

NickLarsenNZ opened this issue Dec 12, 2024 · 3 comments
Assignees
Labels
area:collector Issues for deploying collector

Comments

@NickLarsenNZ
Copy link

NickLarsenNZ commented Dec 12, 2024

Component(s)

collector

What happened?

Description

The collector fails to start when migrating from v1alpha1 to v1beta1 using the following procedure:

  • Change the apiVersion to opentelemetry.io/v1beta1.
  • Remove the | from spec.config, turning the value from a string to an object.

Steps to Reproduce

apiVersion: opentelemetry.io/v1beta1
kind: OpenTelemetryCollector
metadata:
  name: kubernetes-events
spec:
  config:
    receivers:
      # without {}, as per many examples
      k8s_events:

    exporters:
      debug: {}

    service:
      pipelines:
        logs:
          receivers: [k8s_events]
          exporters: [debug]

Expected Result

The collector should start up, and its ConfigMap should show the receivers (and other things enabled without additional config)

apiVersion: v1
kind: ConfigMap
data:
  collector.yaml: |
    receivers:
      k8s_events: {}
...

Or, I'd expect the webhook to tell my the configuration is invalid.

Actual Result

The collector fails to start with: "no receiver configuration specified in config". The webhooks doesn't pick this up.

The generated ConfigMap ends up with an empty receivers section:

apiVersion: v1
kind: ConfigMap
data:
  collector.yaml: |
    receivers: {}
...

Kubernetes Version

1.31.0

Operator version

0.114.1

Collector version

0.114.0 (otel/opentelemetry-collector-k8s:0.114.0)

Environment information

Environment

OS: Nixos

Log output

Error: invalid configuration: no receiver configuration specified in config
2024/12/12 17:14:36 collector server run finished with error: invalid configuration: no receiver configuration specified in config
Stream closed EOF for default/local-kubernetes-events-collector-7bddd5d6bb-7mhjb (otc-container)

Additional context

It works if I change the spec.config to a string config, and use v1alpha.
It also works if I add {} so that the k8s_events receiver doesn't default to null.

@NickLarsenNZ NickLarsenNZ added bug Something isn't working needs triage labels Dec 12, 2024
@NickLarsenNZ
Copy link
Author

NickLarsenNZ commented Dec 12, 2024

If this is not considered a bug, I would think that all examples and test data should then use {} (which is backward compatible with v1alpha1).

For example:

In that case, this issue should be closed and PRs opened to fix config examples in other repos.

@jaronoff97
Copy link
Contributor

@NickLarsenNZ this is documented in our upgrade guide here.

Empty maps, like debug: in the above configuration, should have an explicit value of {}.

I believe our plan is to migrate the v1alpha1 examples once we drop support for that CR. As far as the collector examples go, it may be worth us reaching out to the collector group to update their examples to something more ubiquitously acceptable.

@jaronoff97 jaronoff97 added area:collector Issues for deploying collector discuss-at-sig This issue or PR should be discussed at the next SIG meeting and removed bug Something isn't working needs triage labels Dec 13, 2024
@jaronoff97
Copy link
Contributor

I'll reach out to the collector folks for examples upgrades. It wouldn't hurt to do.

@jaronoff97 jaronoff97 self-assigned this Dec 19, 2024
@jaronoff97 jaronoff97 removed the discuss-at-sig This issue or PR should be discussed at the next SIG meeting label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:collector Issues for deploying collector
Projects
None yet
Development

No branches or pull requests

2 participants