Skip to content

fix(builder): honor service.nodePort for restapi, controller, accounting#183

Open
martbhell wants to merge 1 commit into
SlinkyProject:mainfrom
martbhell:nodeport-from-restapi
Open

fix(builder): honor service.nodePort for restapi, controller, accounting#183
martbhell wants to merge 1 commit into
SlinkyProject:mainfrom
martbhell:nodeport-from-restapi

Conversation

@martbhell
Copy link
Copy Markdown

@martbhell martbhell commented Apr 27, 2026

The chart documents restapi.service.nodePort, controller.service.nodePort, and accounting.service.nodePort (helm/slurm/values.yaml lines 297, 397, 509), but the corresponding ServicePort builders never set NodePort. Setting the field in helm values made it through to the CR's spec.service.nodePort, but the operator silently dropped it when building the Service — kube-apiserver then auto-allocated a random port, and the field was effectively a no-op.

Mirror the pattern already used by loginbuilder/login_service.go: pass spec.NodePort through to the corev1.ServicePort. Add a focused unit test per builder that asserts the propagation.

loginbuilder/login_service.go already has this; loginsets.slinky.service.nodePort in helm values has always worked.

Summary

Checklist

  • I have read
    CONTRIBUTING.md
    and the
    Code of Conduct.
  • New or existing tests cover these changes (where applicable).
  • Documentation is updated if user-visible behavior changes.

Breaking Changes

Testing Notes

Additional Context

The chart documents `restapi.service.nodePort`, `controller.service.nodePort`,
and `accounting.service.nodePort` (helm/slurm/values.yaml lines 297, 397, 509),
but the corresponding ServicePort builders never set NodePort. Setting the
field in helm values made it through to the CR's spec.service.nodePort, but
the operator silently dropped it when building the Service — kube-apiserver
then auto-allocated a random port, and the field was effectively a no-op.

Mirror the pattern already used by loginbuilder/login_service.go: pass
spec.NodePort through to the corev1.ServicePort. Add a focused unit test per
builder that asserts the propagation.

loginbuilder/login_service.go already has this; loginsets.slinky.service.nodePort
in helm values has always worked.

Signed-off-by: Johan Guldmyr <johan@datacrunch.io>
@vivian-hafener
Copy link
Copy Markdown
Contributor

Good morning @martbhell.

Thanks for the contribution, I will review this. Just a note for future reference, we never modify the CHANGELOGs directly, we generally use a Changelog: commit trailer. No need to fix that now, I will handle that myself during review.

Best,
Vivian Hafener

@vivian-hafener vivian-hafener self-assigned this Apr 27, 2026
@martbhell
Copy link
Copy Markdown
Author

Thanks! As a note, this suggestion came from me using Claude code to access slurmrestd api from a node (on the same L2/subnet as a slinky) that hasnt joined the k8s cluster.

@vivian-hafener
Copy link
Copy Markdown
Contributor

Good morning @martbhell,

I've modified your commit to only make changes to the *_service.go files, and added a commit of my own (on our internal branch for this PR) that rewrites the tests to follow the established pattern of one test for each BuildComponentService function, instead of adding new test functions just for NodePort.

Best,
Vivian Hafener

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