Skip to content

Commit 0e6e930

Browse files
authored
Merge pull request #1881 from r2d4/cache-images-4-minikube
Cache images in minikube
2 parents bd258d8 + 3fb711c commit 0e6e930

File tree

226 files changed

+34623
-409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+34623
-409
lines changed

Godeps/Godeps.json

+176-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ KUBE_CROSS_DOCKER_CMD := docker run -w /go/src/$(REPOPATH) --user $(shell id -u)
6767

6868
# $(call MINIKUBE_GO_BUILD_CMD, output file, OS)
6969
define MINIKUBE_GO_BUILD_CMD
70-
$(MINIKUBE_ENV_$(2)) go build --installsuffix cgo -ldflags="$(MINIKUBE_LDFLAGS) $(K8S_VERSION_LDFLAGS)" -a -o $(1) k8s.io/minikube/cmd/minikube
70+
$(MINIKUBE_ENV_$(2)) go build -tags "container_image_ostree_stub containers_image_openpgp" --installsuffix cgo -ldflags="$(MINIKUBE_LDFLAGS) $(K8S_VERSION_LDFLAGS)" -a -o $(1) k8s.io/minikube/cmd/minikube
7171
endef
7272

7373
ifeq ($(BUILD_IN_DOCKER),y)
@@ -113,7 +113,7 @@ endif
113113

114114
.PHONY: e2e-%-amd64
115115
e2e-%-amd64:
116-
GOOS=$* GOARCH=amd64 go test -c k8s.io/minikube/test/integration --tags=integration -o out/$@
116+
GOOS=$* GOARCH=amd64 go test -c k8s.io/minikube/test/integration --tags="integration container_image_ostree_stub containers_image_openpgp" -o out/$@
117117

118118
e2e-windows-amd64.exe: e2e-windows-amd64
119119
mv $(BUILD_DIR)/e2e-windows-amd64 $(BUILD_DIR)/e2e-windows-amd64.exe

cmd/minikube/cmd/start.go

+16-9
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const (
6666
dnsDomain = "dns-domain"
6767
mountString = "mount-string"
6868
disableDriverMounts = "disable-driver-mounts"
69+
cacheImages = "cache-images"
6970
)
7071

7172
var (
@@ -86,6 +87,10 @@ assumes you have already installed one of the VM drivers: virtualbox/vmwarefusio
8687
}
8788

8889
func runStart(cmd *cobra.Command, args []string) {
90+
shouldCacheImages := viper.GetBool(cacheImages)
91+
if shouldCacheImages {
92+
go machine.CacheImagesForBootstrapper(viper.GetString(cmdcfg.Bootstrapper))
93+
}
8994
api, err := machine.NewAPIClient()
9095
if err != nil {
9196
fmt.Fprintf(os.Stderr, "Error getting client: %s\n", err)
@@ -178,15 +183,16 @@ func runStart(cmd *cobra.Command, args []string) {
178183
}
179184

180185
kubernetesConfig := bootstrapper.KubernetesConfig{
181-
KubernetesVersion: selectedKubernetesVersion,
182-
NodeIP: ip,
183-
NodeName: cfg.GetMachineName(),
184-
APIServerName: viper.GetString(apiServerName),
185-
DNSDomain: viper.GetString(dnsDomain),
186-
FeatureGates: viper.GetString(featureGates),
187-
ContainerRuntime: viper.GetString(containerRuntime),
188-
NetworkPlugin: viper.GetString(networkPlugin),
189-
ExtraOptions: extraOptions,
186+
KubernetesVersion: selectedKubernetesVersion,
187+
NodeIP: ip,
188+
NodeName: cfg.GetMachineName(),
189+
APIServerName: viper.GetString(apiServerName),
190+
DNSDomain: viper.GetString(dnsDomain),
191+
FeatureGates: viper.GetString(featureGates),
192+
ContainerRuntime: viper.GetString(containerRuntime),
193+
NetworkPlugin: viper.GetString(networkPlugin),
194+
ExtraOptions: extraOptions,
195+
ShouldLoadCachedImages: shouldCacheImages,
190196
}
191197

192198
clusterBootstrapper, err := GetClusterBootstrapper(api, viper.GetString(cmdcfg.Bootstrapper))
@@ -355,6 +361,7 @@ func init() {
355361
startCmd.Flags().String(containerRuntime, "", "The container runtime to be used")
356362
startCmd.Flags().String(networkPlugin, "", "The name of the network plugin")
357363
startCmd.Flags().String(featureGates, "", "A set of key=value pairs that describe feature gates for alpha/experimental features.")
364+
startCmd.Flags().Bool(cacheImages, true, "If true, cache docker images for the current bootstrapper and load them into the machine.")
358365
startCmd.Flags().Var(&extraOptions, "extra-config",
359366
`A set of key=value pairs that describe configuration that may be passed to different components.
360367
The key should be '.' separated, and the first part before the dot is the component to apply the configuration to.

deploy/addons/kube-dns/kube-dns-controller.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ spec:
4545
containers:
4646
- name: kubedns
4747
image: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.4
48+
imagePullPolicy: IfNotPresent
4849
resources:
4950
# TODO: Set memory limits when we've profiled the container for large
5051
# clusters, then set request = limit to keep this container in
@@ -96,6 +97,7 @@ spec:
9697
mountPath: /kube-dns-config
9798
- name: dnsmasq
9899
image: gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.4
100+
imagePullPolicy: IfNotPresent
99101
livenessProbe:
100102
httpGet:
101103
path: /healthcheck/dnsmasq
@@ -134,6 +136,7 @@ spec:
134136
mountPath: /etc/k8s/dns/dnsmasq-nanny
135137
- name: sidecar
136138
image: gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.4
139+
imagePullPolicy: IfNotPresent
137140
livenessProbe:
138141
httpGet:
139142
path: /metrics

0 commit comments

Comments
 (0)