From bfacb51f44ef8e012470c421e8498c6bd08f82df Mon Sep 17 00:00:00 2001 From: dlorenc Date: Wed, 27 Jun 2018 20:30:21 -0700 Subject: [PATCH 1/4] Fix Kubernetes 1.11 builds Add a versioned flag for the enable-admission-control flags Add a second step to call "kubeadm alpha phase addon all" which seems to be required now to get coredns running. I tested this all the way back to 1.9.0. --- pkg/minikube/bootstrapper/kubeadm/templates.go | 6 ++++-- pkg/minikube/bootstrapper/kubeadm/versions.go | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/minikube/bootstrapper/kubeadm/templates.go b/pkg/minikube/bootstrapper/kubeadm/templates.go index b683b0e2645a..e93dfc64f143 100644 --- a/pkg/minikube/bootstrapper/kubeadm/templates.go +++ b/pkg/minikube/bootstrapper/kubeadm/templates.go @@ -73,8 +73,10 @@ sudo /usr/bin/kubeadm alpha phase controlplane all --config {{.KubeadmConfigFile sudo /usr/bin/kubeadm alpha phase etcd local --config {{.KubeadmConfigFile}} `)) -var kubeadmInitTemplate = template.Must(template.New("kubeadmInitTemplate").Parse( - "sudo /usr/bin/kubeadm init --config {{.KubeadmConfigFile}} {{if .SkipPreflightChecks}}--skip-preflight-checks{{else}}{{range .Preflights}}--ignore-preflight-errors={{.}} {{end}}{{end}}")) +var kubeadmInitTemplate = template.Must(template.New("kubeadmInitTemplate").Parse(` +sudo /usr/bin/kubeadm init --config {{.KubeadmConfigFile}} {{if .SkipPreflightChecks}}--skip-preflight-checks{{else}}{{range .Preflights}}--ignore-preflight-errors={{.}} {{end}}{{end}} && +sudo /usr/bin/kubeadm alpha phase addon all +`)) // printMapInOrder sorts the keys and prints the map in order, combining key // value pairs with the separator character diff --git a/pkg/minikube/bootstrapper/kubeadm/versions.go b/pkg/minikube/bootstrapper/kubeadm/versions.go index a638a4385743..3d33432c94db 100644 --- a/pkg/minikube/bootstrapper/kubeadm/versions.go +++ b/pkg/minikube/bootstrapper/kubeadm/versions.go @@ -205,8 +205,17 @@ var versionSpecificOpts = []VersionedExtraOption{ Key: "admission-control", Value: strings.Join(util.DefaultAdmissionControllers, ","), }, + LessThanOrEqual: semver.MustParse("1.10.10"), GreaterThanOrEqual: semver.MustParse("1.9.0-alpha.0"), }, + { + Option: util.ExtraOption{ + Component: Apiserver, + Key: "enable-admission-plugins", + Value: strings.Join(util.DefaultAdmissionControllers, ","), + }, + GreaterThanOrEqual: semver.MustParse("1.11.0-alpha.0"), + }, } func VersionIsBetween(version, gte, lte semver.Version) bool { From 836aee0084cac38c1734d78179ed017157f93d0f Mon Sep 17 00:00:00 2001 From: dlorenc Date: Thu, 28 Jun 2018 07:40:36 -0700 Subject: [PATCH 2/4] Code review feedback. --- pkg/minikube/bootstrapper/kubeadm/templates.go | 3 ++- pkg/minikube/bootstrapper/kubeadm/versions.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/minikube/bootstrapper/kubeadm/templates.go b/pkg/minikube/bootstrapper/kubeadm/templates.go index e93dfc64f143..b68bd0930109 100644 --- a/pkg/minikube/bootstrapper/kubeadm/templates.go +++ b/pkg/minikube/bootstrapper/kubeadm/templates.go @@ -29,6 +29,7 @@ kind: MasterConfiguration api: advertiseAddress: {{.AdvertiseAddress}} bindPort: {{.APIServerPort}} + controlPlaneEndpoint: localhost kubernetesVersion: {{.KubernetesVersion}} certificatesDir: {{.CertDir}} networking: @@ -75,7 +76,7 @@ sudo /usr/bin/kubeadm alpha phase etcd local --config {{.KubeadmConfigFile}} var kubeadmInitTemplate = template.Must(template.New("kubeadmInitTemplate").Parse(` sudo /usr/bin/kubeadm init --config {{.KubeadmConfigFile}} {{if .SkipPreflightChecks}}--skip-preflight-checks{{else}}{{range .Preflights}}--ignore-preflight-errors={{.}} {{end}}{{end}} && -sudo /usr/bin/kubeadm alpha phase addon all +sudo /usr/bin/kubeadm alpha phase addon kube-dns `)) // printMapInOrder sorts the keys and prints the map in order, combining key diff --git a/pkg/minikube/bootstrapper/kubeadm/versions.go b/pkg/minikube/bootstrapper/kubeadm/versions.go index 3d33432c94db..1dd009852d2e 100644 --- a/pkg/minikube/bootstrapper/kubeadm/versions.go +++ b/pkg/minikube/bootstrapper/kubeadm/versions.go @@ -205,7 +205,7 @@ var versionSpecificOpts = []VersionedExtraOption{ Key: "admission-control", Value: strings.Join(util.DefaultAdmissionControllers, ","), }, - LessThanOrEqual: semver.MustParse("1.10.10"), + LessThanOrEqual: semver.MustParse("1.10.1000"), // Semver doesn't support wildcards. GreaterThanOrEqual: semver.MustParse("1.9.0-alpha.0"), }, { From 29f6fde8f99f8d052775e2d06784a4beeb220e35 Mon Sep 17 00:00:00 2001 From: Jimmi Dyson Date: Wed, 4 Jul 2018 12:21:40 +0100 Subject: [PATCH 3/4] Add missing controlPlaneEndpoint to fix kubeadm templates test --- pkg/minikube/bootstrapper/kubeadm/kubeadm_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm_test.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm_test.go index 42cfc4faf892..7dce62366681 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm_test.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm_test.go @@ -42,6 +42,7 @@ kind: MasterConfiguration api: advertiseAddress: 192.168.1.100 bindPort: 8443 + controlPlaneEndpoint: localhost kubernetesVersion: v1.10.0 certificatesDir: /var/lib/localkube/certs/ networking: @@ -82,6 +83,7 @@ kind: MasterConfiguration api: advertiseAddress: 192.168.1.101 bindPort: 8443 + controlPlaneEndpoint: localhost kubernetesVersion: v1.10.0-alpha.0 certificatesDir: /var/lib/localkube/certs/ networking: @@ -122,6 +124,7 @@ kind: MasterConfiguration api: advertiseAddress: 192.168.1.101 bindPort: 8443 + controlPlaneEndpoint: localhost kubernetesVersion: v1.10.0-alpha.0 certificatesDir: /var/lib/localkube/certs/ networking: @@ -148,6 +151,7 @@ kind: MasterConfiguration api: advertiseAddress: 192.168.1.101 bindPort: 8443 + controlPlaneEndpoint: localhost kubernetesVersion: v1.10.0-alpha.0 certificatesDir: /var/lib/localkube/certs/ networking: @@ -184,6 +188,7 @@ kind: MasterConfiguration api: advertiseAddress: 192.168.1.101 bindPort: 8443 + controlPlaneEndpoint: localhost kubernetesVersion: v1.10.0-alpha.0 certificatesDir: /var/lib/localkube/certs/ networking: From 6d4912a0a30b1480c711417ea686821bc3fde673 Mon Sep 17 00:00:00 2001 From: Jimmi Dyson Date: Wed, 4 Jul 2018 12:23:00 +0100 Subject: [PATCH 4/4] Make builds work with no GOPATH env var explicitly set - this is not needed since 1.8 but the build required it to be set --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c539c0130add..92c2f1f3694c 100755 --- a/Makefile +++ b/Makefile @@ -37,6 +37,7 @@ KERNEL_VERSION ?= 4.16.14 GOOS ?= $(shell go env GOOS) GOARCH ?= $(shell go env GOARCH) +GOPATH ?= $(shell go env GOPATH) BUILD_DIR ?= ./out $(shell mkdir -p $(BUILD_DIR)) @@ -208,7 +209,7 @@ out/test.d: pkg/minikube/assets/assets.go -include out/test.d test: - ./test.sh + GOPATH=$(GOPATH) ./test.sh pkg/minikube/assets/assets.go: $(shell find deploy/addons -type f) which go-bindata || GOBIN=$(GOPATH)/bin go get github.com/jteeuwen/go-bindata/...