-
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
Merged
tstromberg
merged 5 commits into
kubernetes:master
from
marcosdiez:dont-cache-images-when-vmdriver-is-none
Apr 10, 2019
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,7 +135,7 @@ func init() { | |
startCmd.Flags().String(networkPlugin, "", "The name of the network plugin") | ||
startCmd.Flags().Bool(enableDefaultCNI, false, "Enable the default CNI plugin (/etc/cni/net.d/k8s.conf). Used in conjunction with \"--network-plugin=cni\"") | ||
startCmd.Flags().String(featureGates, "", "A set of key=value pairs that describe feature gates for alpha/experimental features.") | ||
startCmd.Flags().Bool(cacheImages, true, "If true, cache docker images for the current bootstrapper and load them into the machine.") | ||
startCmd.Flags().Bool(cacheImages, true, "If true, cache docker images for the current bootstrapper and load them into the machine. Always false with --vm-driver=none.") | ||
startCmd.Flags().Var(&extraOptions, "extra-config", | ||
`A set of key=value pairs that describe configuration that may be passed to different components. | ||
The key should be '.' separated, and the first part before the dot is the component to apply the configuration to. | ||
|
@@ -174,6 +174,23 @@ func runStart(cmd *cobra.Command, args []string) { | |
exit.WithError("Failed to generate config", err) | ||
} | ||
|
||
if viper.GetString(vmDriver) == constants.DriverNone { | ||
/* | ||
Caching images means: | ||
- minikube download the images | ||
- minikube saves them in ~/.minikube/cache | ||
- minikube loads them to the host machine with `docker load -i ~/.minikube/cache/some_images` | ||
|
||
This makes complete sense, except that when --vm-driver=none, the host machine is the local machine. | ||
That means once the images is loaded into docker, it stays there even after reboots and `minikube delete`. | ||
That means they are already cached and nothing needs to be done. Not only that, loading the container with | ||
`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 commentThe 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. |
||
viper.Set(cacheImages, false) | ||
} | ||
|
||
var cacheGroup errgroup.Group | ||
beginCacheImages(&cacheGroup, k8sVersion) | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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®