Skip to content

[helm] Publish each listener's advertised address as a pod env var - #4895

Open
morazow wants to merge 1 commit into
apache:mainfrom
morazow:helm-listener-advertised-env
Open

morazow wants to merge 1 commit into
apache:mainfrom
morazow:helm-listener-advertised-env

Conversation

@morazow

@morazow morazow commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Generative AI disclosure: Yes. Claude Code (Claude Opus 5.5) was used.

Purpose

Linked issue: close #4894

Server pods publish each listener's advertised address as an environment variable, FLUSS_ADVERTISED_LISTENER_<NAME>. Tooling running next to the cluster can read the addresses from the pod instead of rebuilding them from the chart's naming rules.

Brief change log

  • _helpers.tpl: add three helpers that loop over .Values.listeners:
    • fluss.listeners.advertisedEnv emits one FLUSS_ADVERTISED_LISTENER_<NAME>=<host>:<port> entry per listener. INTERNAL uses $(POD_IP), which is the address Fluss already registers for it, since a listener missing from advertised.listeners is advertised at its bind address. The other listeners use the pod's headless-service DNS name.
    • fluss.listeners.bind builds bind.listeners.
    • fluss.listeners.advertised builds advertised.listeners from the new env vars, so the published and the registered addresses cannot differ.
  • sts-coordinator.yaml, sts-tablet.yaml: add the env entries after POD_NAME, POD_NAMESPACE and POD_IP (Kubernetes only expands $(VAR) references to entries defined earlier). The startup command uses the helpers instead of the inline listener strings.
  • deploying-with-helm.md: document the variables.

The registered listeners do not change. With the default values, rendered server.yaml lines become:

bind.listeners: CLIENT://<pod IP>:9124, INTERNAL://<pod IP>:9123
advertised.listeners: CLIENT://<pod>.tablet-server-hs.<ns>.svc.cluster.local:9124, INTERNAL://<pod IP>:9123

Note: kubectl describe and kubectl get -o yaml show the $(VAR) form. The kubelet expands the references only when it starts the container.

Tests

  • New helm/tests/listeners_env_test.yaml (9 cases): env values for both server types, custom ports, an additional listener, and the generated bind.listeners / advertised.listeners strings. All 157 chart tests pass and helm lint is clean.
  • Manual check on a kind cluster with apache/fluss:1.0.0-rc3, 1 coordinator and 3 tablet servers: on every pod, the expanded env values matched the listeners the server registered in ZooKeeper.

API and Format

No.

Documentation

Yes, a paragraph in website/docs/install-deploy/deploying-with-helm.md (Network Configuration).

🤖 Generated with Claude Code

Server pods now get one environment variable per listener,
FLUSS_ADVERTISED_LISTENER_<NAME>, holding that listener's advertised
address as <host>:<port>. Tools such as the Fluss Agent can read these
values instead of rebuilding the addresses outside the chart.

Before this change, the startup command built bind.listeners and
advertised.listeners as shell variables and wrote them into server.yaml.
Only CLIENT was advertised. Fluss advertises a listener that is missing
from advertised.listeners at its bind address, so INTERNAL was
advertised as <pod IP>:<internal port>.

The chart now:
- adds the env entries after POD_NAME, POD_NAMESPACE and POD_IP and
  references them with $(VAR), so Kubernetes expands the values when
  it starts the container
- publishes INTERNAL as $(POD_IP):<port>, the address Fluss already
  registers, and every other listener as the pod's headless-service DNS
  name
- builds advertised.listeners from the new env vars, so the published
  and the registered addresses cannot differ
- generates the env vars, bind.listeners and advertised.listeners by
  looping over .Values.listeners, so additional listeners need no
  template changes

Fluss behaves the same as before: the registered listeners are the same
as with the previous chart.

Tested with new helm-unittest cases (listeners_env_test.yaml) and on a
kind cluster with apache/fluss:1.0.0-rc3. On every pod, the env values
matched the listeners the server registered in ZooKeeper.
@morazow
morazow marked this pull request as ready for review October 26, 2026 15:38
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.

[helm] Publish each listener's advertised address as a pod environment variable

1 participant