fix(tunnel): use flexible OK check for Windows route command output#22860
fix(tunnel): use flexible OK check for Windows route command output#22860bukx wants to merge 1 commit intokubernetes:masterfrom
Conversation
The Windows 'route' command output can vary across different Windows versions, locales, and system configurations. The previous code used a strict string equality check (message != " OK!\r\n") which caused minikube tunnel to fail endlessly on some Windows systems because the actual output differed in whitespace or line endings. This fix replaces the strict equality check with a case-insensitive strings.Contains check for 'OK' after trimming whitespace. This is more robust and handles variations in the route command output across different Windows environments. Fixes kubernetes#11645
|
Invalid commit message issues detected Invalid commit messagesKeywords which can automatically close issues and hashtag(#) mentions are not allowed.
Instructions 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. I understand the commands that are listed here. |
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: bukx 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 |
|
Welcome @bukx! |
|
Hi @bukx. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. 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? |
|
@bukx can you plz sign the CLA https://api.easycla.lfx.linuxfoundation.org/v2/repository-provider/github/sign/18706487/56353740/22860/#/?version=2 |
Problem
Fixes #11645
minikube tunnelon Windows endlessly retries adding a route because the code does a strict string equality check against" OK!\r\n". The Windowsroutecommand output can vary across different Windows versions, locales, and system configurations — meaning the exact whitespace or line endings may differ, causing the check to always fail and triggering an infinite retry loop.Root Cause
In
pkg/minikube/tunnel/route_windows.go, bothEnsureRouteIsAddedandCleanupused:This strict equality fails when the output has slightly different formatting.
Fix
Replaced the strict equality check with a case-insensitive
strings.Containscheck for"OK"after trimming whitespace:This is robust across different Windows environments while still correctly detecting success vs failure.
Also improved error handling in
EnsureRouteIsAddedto properly wrap theerrfromCombinedOutputusing%wbefore checking the output string.Testing
" OK!\r\n"," OK!\n","OK", and other valid success variations