Skip to content
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

Update code to cache correct images for different k8s versions #2849

Merged
merged 3 commits into from
Jun 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 51 additions & 21 deletions pkg/minikube/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import (
"fmt"
"os"
"path/filepath"
"strings"

"github.com/blang/semver"
"github.com/golang/glog"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/homedir"
"k8s.io/kubernetes/pkg/version"
Expand Down Expand Up @@ -215,33 +218,60 @@ var LocalkubeCachedImages = []string{
"gcr.io/k8s-minikube/storage-provisioner:v1.8.0",
}

func GetKubeadmCachedImages(version string) []string {
return []string{
// Dashboard
"k8s.gcr.io/kubernetes-dashboard-amd64:v1.8.1",

// Addon Manager
"k8s.gcr.io/kube-addon-manager:v8.6",
func GetKubeadmCachedImages(kubernetesVersionStr string) []string {

// Pause
"k8s.gcr.io/pause-amd64:3.1",
var images = []string{
"k8s.gcr.io/kube-proxy-amd64:" + kubernetesVersionStr,
"k8s.gcr.io/kube-scheduler-amd64:" + kubernetesVersionStr,
"k8s.gcr.io/kube-controller-manager-amd64:" + kubernetesVersionStr,
"k8s.gcr.io/kube-apiserver-amd64:" + kubernetesVersionStr,
}

// DNS
"k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.8",
"k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.8",
"k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.8",
gt_v1_10 := semver.MustParseRange(">=1.11.0")
v1_10 := semver.MustParseRange(">=1.10.0 <1.11.0")
v1_9 := semver.MustParseRange(">=1.9.0 <1.10.0")
v1_8 := semver.MustParseRange(">=1.8.0 <1.9.0")

// etcd
"k8s.gcr.io/etcd-amd64:3.1.12",
kubernetesVersion, err := semver.Make(strings.TrimPrefix(kubernetesVersionStr, minikubeVersion.VersionPrefix))
if err != nil {
glog.Errorln("Error parsing version semver: ", err)
}

"k8s.gcr.io/kube-proxy-amd64:" + version,
"k8s.gcr.io/kube-scheduler-amd64:" + version,
"k8s.gcr.io/kube-controller-manager-amd64:" + version,
"k8s.gcr.io/kube-apiserver-amd64:" + version,
if v1_10(kubernetesVersion) || gt_v1_10(kubernetesVersion) {
images = append(images, []string{
"k8s.gcr.io/pause-amd64:3.1",
"k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.8",
"k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.8",
"k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.8",
"k8s.gcr.io/etcd-amd64:3.1.12",
}...)

} else if v1_9(kubernetesVersion) {
images = append(images, []string{
"k8s.gcr.io/pause-amd64:3.0",
"k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.7",
"k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.7",
"k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.7",
"k8s.gcr.io/etcd-amd64:3.1.10",
}...)

} else if v1_8(kubernetesVersion) {
images = append(images, []string{
"k8s.gcr.io/pause-amd64:3.0",
"k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.5",
"k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.5",
"k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.5",
"k8s.gcr.io/etcd-amd64:3.0.17",
}...)
}

//Storage Provisioner
images = append(images, []string{
"k8s.gcr.io/kubernetes-dashboard-amd64:v1.8.1",
"k8s.gcr.io/kube-addon-manager:v8.6",
"gcr.io/k8s-minikube/storage-provisioner:v1.8.1",
}
}...)

return images
}

var ImageCacheDir = MakeMiniPath("cache", "images")