Skip to content

Commit

Permalink
Merge pull request #1881 from r2d4/cache-images-4-minikube
Browse files Browse the repository at this point in the history
Cache images in minikube
  • Loading branch information
r2d4 authored Sep 6, 2017
2 parents bd258d8 + 3fb711c commit 0e6e930
Show file tree
Hide file tree
Showing 226 changed files with 34,623 additions and 409 deletions.
184 changes: 176 additions & 8 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ KUBE_CROSS_DOCKER_CMD := docker run -w /go/src/$(REPOPATH) --user $(shell id -u)

# $(call MINIKUBE_GO_BUILD_CMD, output file, OS)
define MINIKUBE_GO_BUILD_CMD
$(MINIKUBE_ENV_$(2)) go build --installsuffix cgo -ldflags="$(MINIKUBE_LDFLAGS) $(K8S_VERSION_LDFLAGS)" -a -o $(1) k8s.io/minikube/cmd/minikube
$(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
endef

ifeq ($(BUILD_IN_DOCKER),y)
Expand Down Expand Up @@ -113,7 +113,7 @@ endif

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

e2e-windows-amd64.exe: e2e-windows-amd64
mv $(BUILD_DIR)/e2e-windows-amd64 $(BUILD_DIR)/e2e-windows-amd64.exe
Expand Down
25 changes: 16 additions & 9 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const (
dnsDomain = "dns-domain"
mountString = "mount-string"
disableDriverMounts = "disable-driver-mounts"
cacheImages = "cache-images"
)

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

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

kubernetesConfig := bootstrapper.KubernetesConfig{
KubernetesVersion: selectedKubernetesVersion,
NodeIP: ip,
NodeName: cfg.GetMachineName(),
APIServerName: viper.GetString(apiServerName),
DNSDomain: viper.GetString(dnsDomain),
FeatureGates: viper.GetString(featureGates),
ContainerRuntime: viper.GetString(containerRuntime),
NetworkPlugin: viper.GetString(networkPlugin),
ExtraOptions: extraOptions,
KubernetesVersion: selectedKubernetesVersion,
NodeIP: ip,
NodeName: cfg.GetMachineName(),
APIServerName: viper.GetString(apiServerName),
DNSDomain: viper.GetString(dnsDomain),
FeatureGates: viper.GetString(featureGates),
ContainerRuntime: viper.GetString(containerRuntime),
NetworkPlugin: viper.GetString(networkPlugin),
ExtraOptions: extraOptions,
ShouldLoadCachedImages: shouldCacheImages,
}

clusterBootstrapper, err := GetClusterBootstrapper(api, viper.GetString(cmdcfg.Bootstrapper))
Expand Down Expand Up @@ -355,6 +361,7 @@ func init() {
startCmd.Flags().String(containerRuntime, "", "The container runtime to be used")
startCmd.Flags().String(networkPlugin, "", "The name of the network plugin")
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().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.
Expand Down
3 changes: 3 additions & 0 deletions deploy/addons/kube-dns/kube-dns-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ spec:
containers:
- name: kubedns
image: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.4
imagePullPolicy: IfNotPresent
resources:
# TODO: Set memory limits when we've profiled the container for large
# clusters, then set request = limit to keep this container in
Expand Down Expand Up @@ -96,6 +97,7 @@ spec:
mountPath: /kube-dns-config
- name: dnsmasq
image: gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.4
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
path: /healthcheck/dnsmasq
Expand Down Expand Up @@ -134,6 +136,7 @@ spec:
mountPath: /etc/k8s/dns/dnsmasq-nanny
- name: sidecar
image: gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.4
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
path: /metrics
Expand Down
Loading

0 comments on commit 0e6e930

Please sign in to comment.