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

Opentelemetry sources define 2 addresses: these aren't exposed by the resultant service #370

Open
grahamnicholls opened this issue Feb 14, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@grahamnicholls
Copy link

grahamnicholls commented Feb 14, 2024

Apologies for terminology mistakes - I am pretty new to k8s.
If an opentelemetry source is configured, it requires 2 address values; one for grpc and one for http (as in the config extract below). However, when helm renders the template, no endpoints are created for the opentelemetry source.

sources:
                vector_logs:
                   type: internal_logs
                vector_metrics:
                   type: internal_metrics
                   scrape_interval_secs: 15
                   namespace: vector

                otlp:
                   type: opentelemetry
                   grpc:
                      address: 0.0.0.0:4317
                     tls:
                       enabled: false
                   http:
                     address: 0.0.0.0:4318
                     tls:
                       enabled: false

                prometheus:
                   type: prometheus_remote_write
                   address: 0.0.0.0:9090

Produces a service looking like so:

$ kd -n gnotel svc vector-gnotel

Name:              vector-gnotel
Namespace:         gnotel
Labels:            [app.kubernetes.io/component=Aggregator](http://app.kubernetes.io/component=Aggregator)
                   [app.kubernetes.io/instance=vector-gnotel](http://app.kubernetes.io/instance=vector-gnotel)
                   [app.kubernetes.io/managed-by=Helm](http://app.kubernetes.io/managed-by=Helm)
                   [app.kubernetes.io/name=vector](http://app.kubernetes.io/name=vector)
                   [app.kubernetes.io/version=0.33.1-distroless-libc](http://app.kubernetes.io/version=0.33.1-distroless-libc)
                   [helm.sh/chart=vector-0.27.0](http://helm.sh/chart=vector-0.27.0)
Annotations:       [argocd.argoproj.io/tracking-id](http://argocd.argoproj.io/tracking-id): gnotel:/Service:gnotel/vector-gnotel
Selector:          [app.kubernetes.io/component=Aggregator,app.kubernetes.io/instance=vector-gnotel,app.kubernetes.io/name=vector](http://app.kubernetes.io/component=Aggregator,app.kubernetes.io/instance=vector-gnotel,app.kubernetes.io/name=vector)

Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                 172.20.25.132
IPs:                172.20.25.132
Port:              api  8686/TCP
TargetPort:        8686/TCP
Endpoints:         [100.71.26.217:8686](http://100.71.26.217:8686/),[100.71.26.222:8686](http://100.71.26.222:8686/)
Port:              prometheus  9090/TCP
TargetPort:        9090/TCP
Endpoints:         [100.71.26.217:9090](http://100.71.26.217:9090/),[100.71.26.222:9090](http://100.71.26.222:9090/)

Session Affinity:  None
Events:            <none>

As can be seen, endpoints are created for the API, and for the prometheus source, but not for the opentelemetry source.

@jszwedko
Copy link
Member

Thanks for filing this @grahamnicholls ! This looks to be a bug in the Helm chart templating. It only looks for address fields at the top-level and for the opentelemetry source they are nested. The fix for this would need to be somewhere around:

{{/*
Generate an array of ServicePorts based on `.Values.customConfig`.
*/}}
{{- define "vector.ports" -}}
{{- range $componentKind, $components := .Values.customConfig }}
{{- if eq $componentKind "sources" }}
{{- tuple $components "_helper.generatePort" | include "_helper.componentIter" }}
{{- else if eq $componentKind "sinks" }}
{{- tuple $components "_helper.generatePort" | include "_helper.componentIter" }}
{{- else if eq $componentKind "api" }}
{{- if $components.enabled }}
- name: api
port: {{ mustRegexFind "[0-9]+$" (get $components "address") }}
protocol: TCP
targetPort: {{ mustRegexFind "[0-9]+$" (get $components "address") }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

In absence of that, you can configure the ports directly via the containerPorts and service.ports. Note I think this will override the automatic generation so all needed ports will need to be specified.

@jszwedko jszwedko added the bug Something isn't working label Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants