feat: add service.extraPorts and extraServices - #5
Merged
piotrlaczykowski merged 1 commit intoAug 14, 2026
Conversation
Two ways to expose more than the single main-container port: - `service.extraPorts` appends ports to the existing Service and declares a matching `containerPort` on the main container whenever `targetPort` resolves to a number. A string `targetPort` references a port declared elsewhere, so no container port is added for it. - `extraServices` renders one additional `<fullname>-<name>` Service per enabled entry, always selecting the same pods — for a headless Service for pod-level discovery, or a second Service with a different type or annotations. Omitting `ports` mirrors the main Service's ports. Both render through a shared `helm-framework.service.ports` helper so a mirroring extraService can't drift from the main Service. Validation: `extraPorts` joins the existing port-uniqueness check, which now tracks port *names* alongside numbers; `extraServices` entries are checked for a required unique name, per-entry port/name uniqueness, named ports once an entry exposes more than one, and a sessionAffinityConfig timeout without ClientIP affinity. The new port-name check also catches a pre-existing bug: two sidecars whose names share their first 12 characters both truncate to the same `sc-<name>` port name. That rendered a Service the API server rejects; it now fails at template time with an explanatory message. Both keys default to `[]`, so the default render is unchanged. Co-Authored-By: claude-flow <ruv@ruv.net>
Kxpi
approved these changes
Aug 14, 2026
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.
What
Two ways to expose more than the single main-container port on a chart built on
helm-framework:service.extraPorts— appends ports to the existing Service, and declares a matchingcontainerPorton the main container whenevertargetPortresolves to a number. A stringtargetPortis treated as a reference to a port declared elsewhere and adds no container port.extraServices— one additional<fullname>-<name>Service per enabled entry, always selecting the same pods. For a headless Service for pod-level discovery, or a second Service with a different type/annotations. Omittingportsmirrors the main Service's ports.Both render through a shared
helm-framework.service.portshelper (mainhttp+extraPorts+ sidecar ports), so a mirroring extraService can't drift from the main Service.Deliberately omitted as YAGNI, easy to add later:
loadBalancerIP,ipFamilies, custom selectors on extra Services.Validation
service.extraPortsjoins the existing port-uniqueness check, which now tracks port names alongside numbers.extraServicesentries are checked for a required unique name, port/name uniqueness within each entry, named ports once an entry exposes more than one, and asessionAffinityConfigtimeout set withoutClientIPaffinity.Note for reviewers
The new port-name check also catches a pre-existing bug: two sidecars whose names share their first 12 characters both truncate to the same
sc-<name>port name (e.g.sc-aaaaaaaaaaaa). That previously rendered a Service the API server rejects; it now fails at template time with an explanatory message. It's a fix, but it is a new template-time failure for any chart in that state — flagging it in case you'd rather it were dropped or downgraded.Testing
main(both keys default to[]) — verified by rendering the test template before and after.extraPorts+ a sidecar + 3extraServices(one disabled): 3 Services emitted, disabled entry skipped, mirrored ports match, string-targetPortentry correctly absent from container ports.helm lintclean on both charts;npm test40/40, including the contract-consistency test that verifies both new keys are declared invalues.yamland read by templates.kubeconformisn't installed locally.Docs
values.yamldocuments both keys with commented examples;README.md,values-reference.md, andvalues-contract.mdregenerated viahelm-docsandscripts/generate-skill.mjs.🤖 Generated with claude-flow