Skip to content

Collector fails to expand env vars when the value is an IPv6 address with trailing double colon #10605

Closed
@congiv

Description

@congiv

Describe the bug

On startup, the collector fails to expand env vars when the value is an IPv6 address with trailing double colon. It treats the value as a map instead of a string.

Steps to reproduce

In my environment, I see this when the collector Pod's IPv6 address has a trailing double colon. Given MY_POD_IP=1111:1111:1111:1111:1111::, this fails to expand:

config:
  receivers:
    zipkin:
      endpoint: '[${env:MY_POD_IP}]:9411'

If you don't have an environment where you can get a IPv6 Pod, you can also reproduce like so:

extraEnvs:
- name: MY_MOCK_IP
  value: '1111:1111:1111:1111:1111::'
# ...
config:
  receivers:
    zipkin:
      endpoint: '[${env:MY_MOCK_IP}]:9411'

What did you expect to see?

The collector start successfully with its config expanded, regardless of whether the Pod's IPv6 address has a leading or trailing double colon.

What did you see instead?

Error: failed to resolve config: cannot resolve the configuration: expanding ${env:MY_POD_IP}: expected convertable to string value type, got map["1111:1111:1111:1111:1111:":<nil>](map[string]interface {})
2024/07/12 17:54:20 collector server run finished with error: Error: failed to resolve config: cannot resolve the configuration: expanding ${env:MY_POD_IP}: expected convertable to string value type, got map["1111:1111:1111:1111:1111:":<nil>](map[string]interface {})

What version did you use?

0.104.0

What config did you use?

config:
  receivers:
    zipkin:
      endpoint: '[${env:MY_POD_IP}]:9411'

Environment

Kubernetes Version: 1.28.11-eks-db838b0
Helm Chart Version: 0.97.1
Docker Image Version: otel/opentelemetry-collector-contrib:0.104.0

Additional context

Looks like this may have been partially resolved with #10343

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions