Skip to content

[tempo] Derive service and container ports from tempo.receivers - #898

Open
fjvbn2003 wants to merge 2 commits into
grafana-community:mainfrom
fjvbn2003:tempo-ports-from-receivers
Open

fjvbn2003 wants to merge 2 commits into
grafana-community:mainfrom
fjvbn2003:tempo-ports-from-receivers

Conversation

@fjvbn2003

@fjvbn2003 fjvbn2003 commented Oct 16, 2026 •

Copy link
Copy Markdown

What this PR does / why we need it

The Service and the StatefulSet do not follow tempo.receivers:

  1. Custom receiver ports are sent to the wrong container port. _ports.tpl takes the Service port from the receiver endpoint but hard-codes targetPort to the default port. With tempo.receivers.otlp.protocols.grpc.endpoint: 0.0.0.0:14317, chart 3.2.0 renders

    - name: grpc-tempo-otlp
      port: 14317
      protocol: TCP
      targetPort: 4317

    Tempo listens on 14317, so nothing answers on the target port. The same applies to the Jaeger ports.

  2. A receiver cannot be removed. --set tempo.receivers.jaeger=null (to turn off the Jaeger receiver) fails to render:

    Error: template: tempo/templates/service.yaml:47:8: executing "tempo/templates/service.yaml" at <include "tempo.udp" .>: error calling include: template: tempo/templates/_ports.tpl:5:24: executing "tempo.udp" at <.Values.tempo.receivers.jaeger.protocols.thrift_compact>: nil pointer evaluating interface {}.protocols
    

    tempo.receivers.jaeger.protocols=null fails the same way. The receivers are rendered into tempo.yaml with toYaml, so the config itself already allows removing them.

  3. Ports that nothing listens on are always exposed. The Service and the container always list 9411 (tempo-zipkin), 55680 and 55681 (legacy OTLP), even though the chart never configures a zipkin receiver and Tempo does not open the legacy OTLP ports.

This PR:

  • reads each receiver endpoint with dig, so a removed receiver or protocol just drops its port;
  • uses the endpoint port as both port and targetPort;
  • adds the zipkin port only when tempo.receivers.zipkin.endpoint is set, and drops 55680/55681;
  • builds the container ports (tempo.containerPorts) from the same endpoints, keeping the existing port names.

Port names do not change, so ServiceMonitors, routes and anything else that refers to a port by name keep working. With the default values the only rendered difference is that 9411, 55680 and 55681 are gone from both Services and from the container. route.yaml still validates backendPort against the Service ports through tempo.servicePorts.

Chart version bumped to 3.2.2.

Which issue this PR fixes

No existing issue that I could find.

Special notes for your reviewer

How I checked it (Helm v3.18.2, helm template of chart 3.2.0 and of this branch):

values 3.2.0 this PR
defaults Service: 6831, 6832, 3200, 14268, 14250, 9411, 55680, 55681, 4317, 4318 Service: 6831, 6832, 3200, 14268, 14250, 4317, 4318
otlp.protocols.grpc.endpoint=0.0.0.0:14317 port: 14317, targetPort: 4317; containerPort 4317 port: 14317, targetPort: 14317; containerPort 14317
jaeger=null render fails (above) Service: 3200, 4317, 4318; tempo.yaml has only otlp
zipkin.endpoint=0.0.0.0:9411 9411 (as always) 9411 on the Service and the container
  • All four ci/*.yaml values files render, and helm lint passes.
  • On a running Tempo 2.10.8 with the chart's default receivers, connecting to the pod on 9411, 55680 and 55681 gives connection refused, while 3200 and 4318 answer.
  • I added tests/ports_test.yaml for the cases above. After rebasing onto main, make helm-unittest HELM_CHART=tempo (helmunittest/helm-unittest:4.2.0-1.1.0 --strict) passes all 6 suites / 45 tests. It also checks service-headless.yaml, which renders the same ports.

Someone who points a client at 9411 without configuring a zipkin receiver loses a Service port that never answered anyway. If you would rather keep that change out of this PR, I can split it.

Checklist

  • DCO signed
  • Chart Version bumped

Prepared with help from Claude (AI), including the local checks described above.

🤖 Generated with Claude Code

@maxsxu maxsxu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template changes and dig-based port derivation look clean, and I verified locally with make helm-unittest HELM_CHART=tempo (helmunittest/helm-unittest:4.2.0-1.1.0 --strict) that all 6 suites / 45 tests pass.

One thing needed before merge: #914 landed on main and already bumped charts/tempo to 3.2.1, so this branch will need a rebase onto main and a bump to 3.2.2.

Comment thread charts/tempo/Chart.yaml Outdated
description: Grafana Tempo Single Binary Mode
type: application
version: 3.2.0
version: 3.2.1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main is already at 3.2.1 after #914 merged, so please rebase onto main and bump this to 3.2.2.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: rebased onto main (a4b0cfa) and bumped the chart to 3.2.2; appVersion stays 3.1.1 from #914. make helm-unittest HELM_CHART=tempo (helmunittest/helm-unittest:4.2.0-1.1.0 --strict) passes all 6 suites / 45 tests locally, and helm lint passes.

(Written with help from Claude (AI).)

# $schema: https://raw.githubusercontent.com/helm-unittest/helm-unittest/refs/heads/main/schema/helm-testsuite.json
suite: receiver ports
templates:
- service.yaml

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional nit: since service-headless.yaml also renders tempo.udp and tempo.tcp, you could include service-headless.yaml here as well to cover both Services.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, added in 264701a: tests/ports_test.yaml now also renders service-headless.yaml, and each Service port assertion runs against both Services.

The Service took each receiver port from tempo.receivers but hard-coded
targetPort to the default port, so changing an endpoint (for example
otlp grpc to 0.0.0.0:14317) sent traffic to a port Tempo does not listen
on. Removing a receiver with `tempo.receivers.jaeger: null` failed to
render with a nil pointer error. The Service and the container also
always exposed 9411 (zipkin), 55680 and 55681 (legacy OTLP), which
nothing listens on unless a zipkin receiver is configured.

Read every receiver endpoint with dig, use the endpoint port as both
port and targetPort, add the zipkin port only when
tempo.receivers.zipkin.endpoint is set, and build the container ports
from the same endpoints.

Signed-off-by: YoungjuKim <[email protected]>
@fjvbn2003
fjvbn2003 force-pushed the tempo-ports-from-receivers branch from 65ef2c3 to 419df51 Compare November 3, 2026 06:03
service-headless.yaml renders the same tempo.udp and tempo.tcp ports as
service.yaml, so check both Services in tests/ports_test.yaml.

Signed-off-by: YoungjuKim <[email protected]>

@maxsxu maxsxu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates — LGTM!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants