Skip to content

Fix/Windows Hosts Path Auto-Detection#359

Merged
cjimti merged 5 commits intomasterfrom
fix/windows_host_path
Jan 3, 2026
Merged

Fix/Windows Hosts Path Auto-Detection#359
cjimti merged 5 commits intomasterfrom
fix/windows_host_path

Conversation

@cjimti
Copy link
Copy Markdown
Member

@cjimti cjimti commented Jan 3, 2026

kubefwd now automatically detects the correct hosts file path based on the operating system:

  • Windows: C:\Windows\System32\drivers\etc\hosts
  • Linux/macOS: /etc/hosts

Previously, the --hosts-path flag defaulted to /etc/hosts on all platforms, causing kubefwd to fail immediately on Windows with "Hosts path does not exist: /etc/hosts".

Changes

  • Added runtime import to detect OS at runtime
  • Added defaultHostsPath() function that returns OS-appropriate path
  • Updated --hosts-path flag to use dynamic default

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Test improvement (new or updated tests)
  • Documentation update
  • Stability/performance improvement
  • Build/CI improvement

Note: New features are developed by maintainers only. See CONTRIBUTING.md for details.

Related Issues

Fixes Windows support for kubefwd.

Testing

  • Ran go test ./... locally
  • Tested manually with a Kubernetes cluster
  • Added new tests for changes (if applicable)

Test Steps

  1. Built for Windows: GOOS=windows GOARCH=amd64 go build -o kubefwd.exe ./cmd/kubefwd
  2. Copied to Windows 11 VM
  3. Verified kubefwd.exe --help shows correct default path
  4. Verified kubefwd.exe svc -n <namespace> works without --hosts-path flag

Checklist

  • My code follows the project's style guidelines (go fmt, go vet)
  • I have read CONTRIBUTING.md
  • I have updated documentation if needed
  • This PR is focused and does not include unrelated changes

Screenshots/Logs (if applicable)

Before (Windows):

kubefwd svc -n mynamespace
FATA[12:34:18] Hosts path does not exist: /etc/hosts

After (Windows):

kubefwd --help | findstr hosts-path
--hosts-path string          Hosts file path. (default "C:\Windows\System32\drivers\etc\hosts")

cjimti added 3 commits January 2, 2026 23:58
- Updated `.goreleaser.yml` to sign both archive and checksum artifacts using Cosign (keyless OIDC).
- Added specific arguments and signature templates for artifact signing.
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 3, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.91%. Comparing base (1351ad1) to head (8cc517e).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cmd/kubefwd/services/services.go 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #359   +/-   ##
=======================================
  Coverage   63.91%   63.91%           
=======================================
  Files          70       70           
  Lines       12457    12461    +4     
=======================================
+ Hits         7962     7965    +3     
- Misses       4165     4166    +1     
  Partials      330      330           
Files with missing lines Coverage Δ
cmd/kubefwd/services/services.go 12.99% <60.00%> (+0.45%) ⬆️

... and 2 files with indirect coverage changes

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

cjimti added 2 commits January 3, 2026 14:06
- Added a `-timeout=60s` flag to fuzz tests to ensure a total timeout for each test’s setup and teardown process.
@cjimti cjimti merged commit 24ef0c4 into master Jan 3, 2026
12 checks passed
@cjimti cjimti deleted the fix/windows_host_path branch January 3, 2026 22:23
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.

1 participant