fix: respect --detect-minikube flag in docker client#10015
fix: respect --detect-minikube flag in docker client#10015singhlovepreet9 wants to merge 1 commit intoGoogleContainerTools:mainfrom
Conversation
The newAPIClient function unconditionally called IsMinikube() to detect minikube clusters, ignoring the --detect-minikube=false flag. This caused skaffold to use minikube's docker daemon even when explicitly told not to. Add DetectMinikube() to docker.Config interface and gate the IsMinikube check on it, consistent with how config/util.go already handles this flag. Fixes GoogleContainerTools#9883
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a bug where Skaffold's Docker client would erroneously detect and utilize Minikube's Docker daemon, even when the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where the --detect-minikube=false flag was not being respected by the Docker client. The changes correctly introduce a DetectMinikube() bool method to the docker.Config interface and use it to conditionally perform minikube detection. The fix is implemented across the necessary components, including the RunContext and various test stubs.
My review includes a couple of suggestions to improve the testability of the new logic by making the test stubs more flexible. Overall, the changes are well-implemented and address the reported bug.
|
|
||
| func (d fakeDockerConfig) GetKubeContext() string { return d.kubeContext } | ||
| func (d fakeDockerConfig) MinikubeProfile() string { return "" } | ||
| func (d fakeDockerConfig) DetectMinikube() bool { return true } |
There was a problem hiding this comment.
Hardcoding true here for DetectMinikube means that integration tests using SetupDockerClient will always run with minikube detection enabled. This prevents testing the behavior when this flag is false. Consider making this configurable, for example by adding a field to fakeDockerConfig, to allow for more comprehensive testing.
| func (m configStub) DetectMinikube() bool { | ||
| return true | ||
| } |
There was a problem hiding this comment.
While hardcoding true maintains the previous behavior for existing tests, it prevents testing scenarios where minikube detection is disabled (--detect-minikube=false). To improve testability of the new logic, consider making this value configurable. You could, for example, add a detectMinikube field to the configStub struct and initialize it in NewConfigStub.
Summary
Fixes #9883
newAPIClientinpkg/skaffold/docker/client.gounconditionally calledcluster.GetClient().IsMinikube()to detect minikube, ignoring the--detect-minikube=falseflag.--detect-minikube=false.DetectMinikube() boolto thedocker.Configinterface and gated theIsMinikubecheck on it — consistent with howconfig/util.go(line 252) already handles this flag.Test plan
go build ./pkg/skaffold/... ./cmd/...compiles cleanly--detect-minikube=false, the docker client no longer queries minikube