Skip to content

Enable Windows CGO cross-compilation in release workflow#391

Merged
cjimti merged 2 commits intomasterfrom
fix/windows-cgo-dns
Feb 4, 2026
Merged

Enable Windows CGO cross-compilation in release workflow#391
cjimti merged 2 commits intomasterfrom
fix/windows-cgo-dns

Conversation

@cjimti
Copy link
Copy Markdown
Member

@cjimti cjimti commented Feb 4, 2026

Summary

Fixes #390 - Windows users with VPN connections couldn't connect to clusters when the API server hostname required VPN-specific DNS resolution.

The root cause: Go 1.24's pure-Go DNS resolver (used with CGO_ENABLED=0) doesn't respect Windows per-adapter DNS settings. When we upgraded from Go 1.18 to 1.24 in v1.23.0, this broke DNS resolution for users on VPNs with custom DNS servers.

Changes

  • Split goreleaser builds into two configurations:
    • kubefwd - Linux/macOS with CGO_ENABLED=0 (static binaries for Alpine)
    • kubefwd-windows - Windows with CGO_ENABLED=1 (native DNS via Windows API)
  • Added MinGW cross-compiler installation to release workflow
  • Windows builds use x86_64-w64-mingw32-gcc (amd64) and i686-w64-mingw32-gcc (386)

Testing

  • Local cross-compilation verified on macOS with MinGW
  • Goreleaser snapshot build completed successfully
  • Both Windows binaries (amd64, 386) are valid PE32/PE32+ executables

- Install MinGW in GitHub Actions for Windows CGO builds.
- Add separate GoReleaser configuration for Windows with CGO enabled.
- Configure native DNS resolution for Windows builds to resolve VPN DNS routing issues.
- Document exclusion of Windows builds from Docker images.
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.13%. Comparing base (7bd7d10) to head (fbf7813).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #391      +/-   ##
==========================================
+ Coverage   81.12%   81.13%   +0.01%     
==========================================
  Files          70       70              
  Lines       12665    12665              
==========================================
+ Hits        10274    10276       +2     
+ Misses       1986     1985       -1     
+ Partials      405      404       -1     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cjimti cjimti merged commit c08d613 into master Feb 4, 2026
11 of 12 checks passed
@cjimti cjimti deleted the fix/windows-cgo-dns branch February 4, 2026 19:04
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.

Connecting to Wireguard DNS is broken since 1.23.0

1 participant