From f968cb7709ab7e5aedec1a46e18b32bd93920548 Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Fri, 8 Mar 2019 10:52:13 -0800 Subject: [PATCH 1/3] Don't try to run the images pull command on old versions of kubeadm --- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index f0cf0727396b..be970d1286e3 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -314,6 +314,14 @@ func (k *KubeadmBootstrapper) DeleteCluster(k8s config.KubernetesConfig) error { // PullImages downloads images that will be used by RestartCluster func (k *KubeadmBootstrapper) PullImages(k8s config.KubernetesConfig) error { + version, err := ParseKubernetesVersion(k8s.KubernetesVersion) + if err != nil { + return errors.Wrap(err, "parsing kubernetes version") + } + if version.LT(semver.MustParse("1.11.0")) { + return fmt.Errorf("pull command is not supported by kubeadm v%s", version) + } + cmd := fmt.Sprintf("sudo kubeadm config images pull --config %s", constants.KubeadmConfigFile) if err := k.c.Run(cmd); err != nil { return errors.Wrapf(err, "running cmd: %s", cmd) From 0c1b51ced3ebb9a8dc40716b8c20ee46c3b1d60a Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Wed, 20 Mar 2019 10:07:25 -0700 Subject: [PATCH 2/3] Use --kubeconfig for v1.10.x, instead of skipping the pull --- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index be970d1286e3..425cb64fe6f0 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -318,11 +318,13 @@ func (k *KubeadmBootstrapper) PullImages(k8s config.KubernetesConfig) error { if err != nil { return errors.Wrap(err, "parsing kubernetes version") } + + cFlag := "config" if version.LT(semver.MustParse("1.11.0")) { - return fmt.Errorf("pull command is not supported by kubeadm v%s", version) + cFlag := "kubeconfig" } - cmd := fmt.Sprintf("sudo kubeadm config images pull --config %s", constants.KubeadmConfigFile) + cmd := fmt.Sprintf("sudo kubeadm config images pull --%s %s", cFlag, constants.KubeadmConfigFile) if err := k.c.Run(cmd); err != nil { return errors.Wrapf(err, "running cmd: %s", cmd) } From 7eeb0a792527f3c20427285697edfe62d97c737e Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Wed, 20 Mar 2019 16:40:12 -0700 Subject: [PATCH 3/3] Revert "Use --kubeconfig for v1.10.x, instead of skipping the pull" This reverts commit 0c1b51ced3ebb9a8dc40716b8c20ee46c3b1d60a. --- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index e27f58757ee8..cd7afeb4ec4f 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -318,13 +318,11 @@ func (k *KubeadmBootstrapper) PullImages(k8s config.KubernetesConfig) error { if err != nil { return errors.Wrap(err, "parsing kubernetes version") } - - cFlag := "config" if version.LT(semver.MustParse("1.11.0")) { - cFlag := "kubeconfig" + return fmt.Errorf("pull command is not supported by kubeadm v%s", version) } - cmd := fmt.Sprintf("sudo kubeadm config images pull --%s %s", cFlag, constants.KubeadmConfigFile) + cmd := fmt.Sprintf("sudo kubeadm config images pull --config %s", constants.KubeadmConfigFile) if err := k.c.Run(cmd); err != nil { return errors.Wrapf(err, "running cmd: %s", cmd) }