Skip to content

start: exit with usage error on unparsable --registry-mirror URL - #23986

Open
Sahil-coder-30 wants to merge 2 commits into
kubernetes:masterfrom
Sahil-coder-30:fix-registry-mirror-panic
Open

Sahil-coder-30 wants to merge 2 commits into
kubernetes:masterfrom
Sahil-coder-30:fix-registry-mirror-panic

Conversation

@Sahil-coder-30

@Sahil-coder-30 Sahil-coder-30 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

fixes #23985

If url.Parse fails in validateRegistryMirror, we only log the error and then read URL.Scheme on a nil pointer, so minikube start panics.

validateRegistryMirror now takes the mirror list and returns the bad url as an error (still logging the url.Parse error), and validateFlags exits with reason.Usage. The user message stays in validateFlags so it is still translated. Added a test for valid and invalid mirrors, and ran make generate-docs for the translation changes.

before:

$ minikube start --driver=ssh --ssh-ip-address=192.0.2.1 --registry-mirror='http://[::1' --dry-run
E1105 ... start.go:1598] Error Parsing URL:  parse "http://[::1": missing ']' in host
panic: runtime error: invalid memory address or nil pointer dereference

after:

$ minikube start --driver=ssh --ssh-ip-address=192.0.2.1 --registry-mirror='http://[::1' --dry-run
E1106 ... start.go:1599] Error Parsing URL:  parse "http://[::1": missing ']' in host
X Exiting due to MK_USAGE: The url provided with the --registry-mirror flag is invalid: http://[::1

@kubernetes-prow kubernetes-prow Bot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Nov 5, 2026
@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Sahil-coder-30 / name: Sahil (3087aa5)

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Sahil-coder-30
Once this PR has been reviewed and has the lgtm label, please assign prezha for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 5, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @Sahil-coder-30!

It looks like this is your first PR to kubernetes/minikube 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/minikube has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow kubernetes-prow Bot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 5, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @Sahil-coder-30. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@minikube-bot

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 5, 2026
@Sahil-coder-30
Sahil-coder-30 force-pushed the fix-registry-mirror-panic branch from 3087aa5 to 340d51d Compare November 5, 2026 07:19
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Nov 5, 2026
Comment thread cmd/minikube/cmd/start_test.go Resolved
@Sahil-coder-30
Sahil-coder-30 force-pushed the fix-registry-mirror-panic branch from 340d51d to 228bc14 Compare November 5, 2026 11:19
@Sahil-coder-30
Sahil-coder-30 requested a review from nirs November 5, 2026 15:51
Comment thread cmd/minikube/cmd/start.go Resolved
Comment thread cmd/minikube/cmd/start_test.go Resolved
Comment thread cmd/minikube/cmd/start.go Resolved
Comment thread cmd/minikube/cmd/start.go Resolved
@Sahil-coder-30
Sahil-coder-30 requested a review from nirs November 6, 2026 06:57
@Sahil-coder-30

Copy link
Copy Markdown
Contributor Author

@nirs updated the PR based on your review, PTAL

@nirs

nirs commented Nov 11, 2026

Copy link
Copy Markdown
Member

@Sahil-coder-30 Looks good now.

To complete please squash the commit to single commit.

The easiest way to update the translations and docs is to revent the translations changes, commit your fix, and run make generate-docs to update docs and translations. You can commit the generated changes in a separate commit.

validateRegistryMirror logged the url.Parse error and kept going.
url.Parse returns a nil *URL on error, so the next line dereferenced
nil and minikube start panicked on a value like 'http://[::1'.

Make validateRegistryMirror take the mirror list and return an error,
including when the URL can't be parsed. validateFlags exits with
reason.Usage, the same way it handles validateRuntime, validateGPUs
and the other validators.

Add a table test covering valid mirrors, a bad scheme, a path and an
unparsable URL.

Signed-off-by: Sahil <sahilsharma3043@gmail.com>
Generated with make generate-docs.

Signed-off-by: Sahil <sahilsharma3043@gmail.com>
@Sahil-coder-30
Sahil-coder-30 force-pushed the fix-registry-mirror-panic branch from d551105 to 17b6020 Compare November 12, 2026 12:40
@Sahil-coder-30

Copy link
Copy Markdown
Contributor Author

@nirs Squashed the fix into one commit and put the make generate-docs output in a separate commit, rebased on current master. Thanks for the review!

@Sahil-coder-30

Copy link
Copy Markdown
Contributor Author

@nirs gentle ping, the commits are squashed as you suggested. Could you take another look when you get a chance? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

start: "--registry-mirror" with an unparsable URL panics instead of printing a usage error

3 participants