-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Don't cache images when --vmdriver=none #4059
Don't cache images when --vmdriver=none #4059
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: marcosdiez If they are not already assigned, you can assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @marcosdiez. 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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
Can one of the admins verify this patch? |
cmd/minikube/cmd/start.go
Outdated
`docker load -i ~/.minikube/cache/some_images` is unecessary and takes time. | ||
As a bonus, we save disk space. | ||
*/ | ||
console.OutStyle("starting-none", "Caching of container images is disabled when --vm-driver=none") |
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.
Remove this line - minikube, particularly with the none driver, has enough console output as is.
Thanks for the PR! It looks like it does the right thing - just one minor comment. |
@minikube-bot OK to test |
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.
Sounds to good me, it is a little disappointing that it reloads images that are already there.
I suppose that is wanted behaviour when using weird "tags" like latest
, but maybe it could be fixed for all scenarios - i.e. if we already have the tag (or digest?) maybe we shouldn't be loading anything anywhere
@afbjorklund I believe even with weird tags like Kubernetes itself has a every interesting policy for tags. That means if we cache an image with the latest tag, kubernetes will try to download it again anyway. Thinking about it a little bit further, it's worse! Then kubernetes would launch, check the version and download the newest version (because minikube's version is old) Next time I reboot my laptop and run minikube again, minikube would put back the old version of latest and kubernetes would have to download once more. |
Yeah, that makes sense... And I guess even if you did reload the same image it would still reuse the layers - haven't tested |
cmd/minikube/cmd/start.go
Outdated
@@ -174,6 +174,22 @@ func runStart(cmd *cobra.Command, args []string) { | |||
exit.WithError("Failed to generate config", err) | |||
} | |||
|
|||
if viper.GetString(vmDriver) == constants.DriverNone { | |||
/* | |||
Caching images means: |
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.
I think we can do with a much smaller comment:
// Optimization: images will be persistently loaded into host Docker, so no need to duplicate work.
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.
And to be policitally correct it should be "the container runtime", not Docker®
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.
Thank you!
Since #3917, images are cached by default.
That is great, except that it does not make sense when
--vmdriver=none
.When cache is enabled,
minikube
download the images to~/.minikube/cache
minikube
loads them (docker load -i ~/.minikube/cache/someimage
)When
--vmdriver=none
, the machine's docker is used, so any loaded image will be stored there "forever" anyway. Hence they are already cached. And setting the cache enable has actually two downsides:minikube
launch it will load images from~/.minikube/cache/someimage
to docker, even though they are there already.So these 5 lines of code do speedup the launch!