Fix CSI controller URL for IPv6 service hosts#1165
Conversation
Build the CSI controller REST endpoint with net.JoinHostPort so IPv6 service hosts from Kubernetes environment variables are bracketed correctly while preserving IPv4 and DNS host behavior. Add unit coverage for IPv6, IPv4, and DNS controller hosts. Fixes NetApp#1164 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Maximilian Rink <github@maxrink.de>
|
/needs-changelog |
|
CI is currently blocked on the changelog-label gate. I commented Could a maintainer please add the |
|
External PRs will generally be copied into our internal test system and if/when merged they'll automatically propagate back out to this public repository fully merged. So don't worry too much about the label or checks here. |
Changelog label requiredThis PR must have exactly one changelog label before it can merge:
Set Merge is blocked only until one of these labels is set — release note or rationale text in the PR description is encouraged but not required to merge. |
Change description
Fix CSI node registration when
TRIDENT_CSI_SERVICE_HOSTcontains an IPv6 literal.The node plugin used string concatenation to build the controller REST endpoint as
https://<host>:<port>. With an IPv6 service host such as2001:db8::10, that produced an invalid URL likehttps://2001:db8::10:34571, causing Go URL parsing to fail beforeCreateNodecould register the node with the CSI controller.This change builds the host/port portion with
net.JoinHostPort, producinghttps://[2001:db8::10]:34571for IPv6 while preserving existing IPv4 and DNS-name behavior.Fixes #1164
Project tracking
External community bug fix tracked by GitHub issue #1164.
Do any added TODOs have an issue in the backlog?
No TODOs added.
Did you add unit tests? Why not?
Yes. Added
TestControllerRestURLcovering IPv6, IPv4, and DNS host inputs.Does this code need functional testing?
No dedicated functional test is required for this small URL-construction fix. The unit test covers the bug condition directly.
Is a code review walkthrough needed? why or why not?
No. The change is limited to constructing the controller REST URL with
net.JoinHostPortand adding focused unit coverage.Should additional test coverage be executed in addition to pre-merge?
No additional coverage beyond existing pre-merge testing is expected.
Does this code need a note in the changelog?
/needs-changelogThis affects CSI node readiness on IPv6-only Kubernetes clusters when service-link environment variables are present.
Changelog
Fixed CSI node registration when the controller service host is provided as an IPv6 literal by Kubernetes service-link environment variables.
Does this code require documentation changes?
No. This is an internal URL-construction bug fix with no user-facing configuration changes.
Additional Information
Affected released tags checked locally:
v26.02.1andv26.06.0both contain the unbracketed controller URL construction. Currentmasteralso contained it before this change.Validation performed: