Skip to content

fix: properly format IPv6 addresses in server URLs#906

Open
Kristian-ZH wants to merge 1 commit into
rancher:mainfrom
Kristian-ZH:fix/ipv6-server-url-formatting
Open

fix: properly format IPv6 addresses in server URLs#906
Kristian-ZH wants to merge 1 commit into
rancher:mainfrom
Kristian-ZH:fix/ipv6-server-url-formatting

Conversation

@Kristian-ZH
Copy link
Copy Markdown
Member

@Kristian-ZH Kristian-ZH commented May 19, 2026

When provisioning nodes with IPv6 control plane endpoints, the bootstrap provider was generating invalid server URLs in the RKE2 configuration.

Invalid format: https://fd12:3456:890b::250:6443
Correct format: https://[fd12:3456:890b::250]:6443

This fix adds a formatServerURL() helper function that:

  • Detects IPv6 addresses using net.ParseIP()
  • Wraps IPv6 addresses in brackets per RFC 3986
  • Leaves IPv4 addresses and hostnames unchanged

The fix is applied to all three server URL generation points:

  • Init control plane config
  • Join control plane config
  • Worker node config

@Kristian-ZH Kristian-ZH requested a review from a team as a code owner May 19, 2026 15:53
Comment thread bootstrap/internal/controllers/rke2config_controller.go Outdated
@Kristian-ZH Kristian-ZH force-pushed the fix/ipv6-server-url-formatting branch from cdb9f23 to 827c669 Compare May 20, 2026 07:52
When provisioning nodes with IPv6 control plane endpoints, the bootstrap
provider was generating invalid server URLs in the RKE2 configuration.

Invalid format:  https://fd12:3456:890b::250:6443
Correct format:  https://[fd12:3456:890b::250]:6443

This fix uses the standard library net.JoinHostPort function which
properly handles IPv6 bracket notation per RFC 3986. The function
automatically wraps IPv6 addresses in brackets while leaving IPv4
addresses and hostnames unchanged.

The fix is applied to all three server URL generation points:
- Init control plane config
- Join control plane config
- Worker node config

This eliminates the need for sed workarounds in user manifests.

Fixes: Invalid IPv6 URL parsing in RKE2 bootstrap config
Signed-off-by: Claude Sonnet 4.5 <noreply@anthropic.com>
@Kristian-ZH Kristian-ZH force-pushed the fix/ipv6-server-url-formatting branch from 827c669 to 5282e21 Compare May 20, 2026 07:56
Copy link
Copy Markdown
Contributor

@hardys hardys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@furkatgofurov7 furkatgofurov7 enabled auto-merge May 26, 2026 22:18
@furkatgofurov7
Copy link
Copy Markdown
Contributor

@Kristian-ZH hi, thanks for the change, however, the repository has required settings so that all commits must have verified signatures, otherwise we can't merge it. Please sign your commit, the change LGTM!

@furkatgofurov7 furkatgofurov7 disabled auto-merge May 27, 2026 08:59
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.

5 participants