fix(chart): proxy service honors service.nodePort#150
Open
kamir wants to merge 2 commits into
Open
Conversation
The proxy Service template did not render spec.ports[0].nodePort, so with type=NodePort Kubernetes assigned a random node port and a fixed host:port mapping (e.g. a kind host 9092 -> 30092 mapping) could never reach the proxy. Render nodePort when type==NodePort and a nodePort is set; default empty keeps the auto-assign behaviour. Lets the proxy be pinned to a known NodePort, which matters because the proxy is the single Kafka entrypoint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a self-contained chart template test for the proxy Service nodePort behaviour (test/chart/proxy-nodeport_test.sh), wired as `make test-chart-proxy-nodeport`. It runs `helm template` with three value-sets and asserts the rendered nodePort: 1. type=NodePort + nodePort=30092 -> renders nodePort: 30092 2. type=NodePort + empty -> line omitted (auto-assign) 3. type=LoadBalancer + value -> line suppressed helm only, no plugins, no cluster. Document proxy.service.nodePort in the chart README under a new "Proxy Service" section, including the valid NodePort range 30000-32767. Note in values.yaml that the field is scoped to the proxy (the single Kafka entrypoint); console/mcp expose service.type but are left as-is and tracked separately. Default render is unchanged; the field is opt-in. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The proxy
Servicetemplate did not renderspec.ports[0].nodePort. Withproxy.service.type=NodePort, Kubernetes then assigns a random node port, so afixed host-to-node-port mapping (for example a kind
hostPort: 9092 -> containerPort: 30092mapping) can never reach the proxy. Without a fixednodePort, Kubernetes assigns a random one and a pinned host:port mapping never
reaches the proxy.
Fix
Render
nodePorton the kafka port whentype == NodePortandproxy.service.nodePortis set; default empty keeps Kubernetes auto-assignment.This lets operators pin the proxy to a known NodePort, which matters because the
proxy is the single Kafka entrypoint. Default render is byte-identical to
pre-PR; the key is opt-in.
Test
Added
test/chart/proxy-nodeport_test.sh, a self-contained chart template test(helm only, no plugins, no cluster). It runs
helm templatewith threevalue-sets and asserts the rendered
nodePort:type=NodePort,nodePort=30092nodePort: 30092type=NodePort,nodePort=""type=LoadBalancer,nodePort=30092Wired into the Makefile as
make test-chart-proxy-nodeport:Reproducible evidence
Case 1, NodePort with a pinned
nodePort:Case 2, NodePort with the default empty
nodePort(the line is absent, soKubernetes auto-assigns):
Default render (no overrides) contains zero
nodePortlines, confirming thedefault is unchanged from before this PR.
In practice this is the mechanism behind a fixed host:port entrypoint: a proxy
Service pinned to nodePort
30092, mapped to a host port (for example9092/9292), is what makes a Kafka client able to reach the proxy at a knownhost:portinstead of a random node port that changes every install.Scope
This change is proxy-only, because the proxy is the single Kafka entrypoint that
external clients connect to. The
consoleandmcpservices also exposeservice.typebut are left as-is and tracked separately; widening thischart-wide is out of scope for this fix.
README
Documented
proxy.service.nodePortunder a new "Proxy Service" section in thechart README, including the valid NodePort range
30000-32767(a value outsideit renders but is rejected at apply time).
Part of a small series upstreaming deployment-hardening deltas we currently
carry.