-
Notifications
You must be signed in to change notification settings - Fork 5.2k
kubeconfig: normalize generated cert paths to forward slashes #21845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kubeconfig: normalize generated cert paths to forward slashes #21845
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: bobsira The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @bobsira. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes Windows-specific test failures by normalizing certificate paths in generated kubeconfig files to use forward slashes consistently across all platforms. The issue arose from mixing filepath.Join (which uses backslashes on Windows) with path.Join (which always uses forward slashes), creating hybrid paths that caused test failures.
Key Changes:
- Added
filepath.ToSlash()calls to convert OS-specific path separators to forward slashes before joining paths - Ensures generated certificate paths in kubeconfig use forward slashes regardless of the operating system
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@bobsira can you put in the PR description which Unit Test this PR is fixing ? |
This PR normalizes generated kubeconfig certificate paths by converting any Windows backslashes to forward slashes when building new entries in
populateCerts (kubeconfig.go). Prior logic mixedfilepath.Join(producing \ on Windows) withpath.Join(always /), creating hybrid paths like\home\user\.minikube\profiles\minikube/client.crt. The tests (TestUpdateIPandTestMissingContext) compare kubeconfig objects via raw string equality (configEquals), so those mixed separators caused mismatches only on Windows.It Fixes These Two Tests:
TestUpdateIP: When adding or updating the minikube cluster/user entries, normalized paths now match the forward‑slash fixtures (kubeConfigWithoutHTTPSUpdated, etc.), eliminating false diffs.TestMissingContext: Rewriting the missing context also regenerates cluster/user entries; normalized paths prevent separator differences from triggering a failure.Scope:
minikube/pkg/minikube/kubeconfig/kubeconfig_test.go
Line 399 in 87ccec3
minikube/pkg/minikube/kubeconfig/kubeconfig_test.go
Line 494 in 87ccec3
Test Failures before the fix
Test Run with the fix
Test Failures before the fix
Test Run with the fix