Upgrade storage provisioner to v2

pull/8909/head
Priya Wadhwa 2020-08-03 13:48:09 -04:00
parent 5ba7281a0a
commit 0538dddd9d
8 changed files with 35 additions and 24 deletions

View File

@ -87,8 +87,7 @@ SHA512SUM=$(shell command -v sha512sum || echo "shasum -a 512")
GVISOR_TAG ?= latest GVISOR_TAG ?= latest
# storage provisioner tag to push changes to # storage provisioner tag to push changes to
# to update minikubes default, update pkg/minikube/bootstrapper/images STORAGE_PROVISIONER_TAG ?= v2
STORAGE_PROVISIONER_TAG ?= latest
# TODO: multi-arch manifest # TODO: multi-arch manifest
ifeq ($(GOARCH),amd64) ifeq ($(GOARCH),amd64)
@ -98,7 +97,7 @@ STORAGE_PROVISIONER_IMAGE ?= $(REGISTRY)/storage-provisioner-$(GOARCH):$(STORAGE
endif endif
# Set the version information for the Kubernetes servers # Set the version information for the Kubernetes servers
MINIKUBE_LDFLAGS := -X k8s.io/minikube/pkg/version.version=$(VERSION) -X k8s.io/minikube/pkg/version.isoVersion=$(ISO_VERSION) -X k8s.io/minikube/pkg/version.isoPath=$(ISO_BUCKET) -X k8s.io/minikube/pkg/version.gitCommitID=$(COMMIT) MINIKUBE_LDFLAGS := -X k8s.io/minikube/pkg/version.version=$(VERSION) -X k8s.io/minikube/pkg/version.isoVersion=$(ISO_VERSION) -X k8s.io/minikube/pkg/version.isoPath=$(ISO_BUCKET) -X k8s.io/minikube/pkg/version.gitCommitID=$(COMMIT) -X k8s.io/minikube/pkg/version.storageProvisionerVersion=$(STORAGE_PROVISIONER_TAG)
PROVISIONER_LDFLAGS := "-X k8s.io/minikube/pkg/storage.version=$(STORAGE_PROVISIONER_TAG) -s -w -extldflags '-static'" PROVISIONER_LDFLAGS := "-X k8s.io/minikube/pkg/storage.version=$(STORAGE_PROVISIONER_TAG) -s -w -extldflags '-static'"
MINIKUBEFILES := ./cmd/minikube/ MINIKUBEFILES := ./cmd/minikube/

View File

@ -98,7 +98,7 @@ spec:
hostNetwork: true hostNetwork: true
containers: containers:
- name: storage-provisioner - name: storage-provisioner
image: {{default "gcr.io/k8s-minikube" .ImageRepository}}/storage-provisioner{{.ExoticArch}}:v1.8.1 image: {{default "gcr.io/k8s-minikube" .ImageRepository}}/storage-provisioner{{.ExoticArch}}:{{.StorageProvisionerVersion}}
command: ["/storage-provisioner"] command: ["/storage-provisioner"]
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
volumeMounts: volumeMounts:

View File

@ -22,6 +22,7 @@ import (
"k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/vmpath" "k8s.io/minikube/pkg/minikube/vmpath"
"k8s.io/minikube/pkg/version"
) )
// Addon is a named list of assets, that can be enabled // Addon is a named list of assets, that can be enabled
@ -452,17 +453,19 @@ func GenerateTemplateData(cfg config.KubernetesConfig) interface{} {
ea = "-" + runtime.GOARCH ea = "-" + runtime.GOARCH
} }
opts := struct { opts := struct {
Arch string Arch string
ExoticArch string ExoticArch string
ImageRepository string ImageRepository string
LoadBalancerStartIP string LoadBalancerStartIP string
LoadBalancerEndIP string LoadBalancerEndIP string
StorageProvisionerVersion string
}{ }{
Arch: a, Arch: a,
ExoticArch: ea, ExoticArch: ea,
ImageRepository: cfg.ImageRepository, ImageRepository: cfg.ImageRepository,
LoadBalancerStartIP: cfg.LoadBalancerStartIP, LoadBalancerStartIP: cfg.LoadBalancerStartIP,
LoadBalancerEndIP: cfg.LoadBalancerEndIP, LoadBalancerEndIP: cfg.LoadBalancerEndIP,
StorageProvisionerVersion: version.GetStorageProvisionerVersion(),
} }
return opts return opts

View File

@ -23,6 +23,7 @@ import (
"runtime" "runtime"
"github.com/blang/semver" "github.com/blang/semver"
"k8s.io/minikube/pkg/version"
) )
// Pause returns the image name to pull for a given Kubernetes version // Pause returns the image name to pull for a given Kubernetes version
@ -127,7 +128,7 @@ func auxiliary(mirror string) []string {
// storageProvisioner returns the minikube storage provisioner image // storageProvisioner returns the minikube storage provisioner image
func storageProvisioner(mirror string) string { func storageProvisioner(mirror string) string {
return path.Join(minikubeRepo(mirror), "storage-provisioner"+archTag(false)+"v1.8.1") return path.Join(minikubeRepo(mirror), "storage-provisioner"+archTag(false)+version.GetStorageProvisionerVersion())
} }
// dashboardFrontend returns the image used for the dashboard frontend // dashboardFrontend returns the image used for the dashboard frontend

View File

@ -24,7 +24,7 @@ import (
func TestAuxiliary(t *testing.T) { func TestAuxiliary(t *testing.T) {
want := []string{ want := []string{
"gcr.io/k8s-minikube/storage-provisioner:v1.8.1", "gcr.io/k8s-minikube/storage-provisioner:v2",
"kubernetesui/dashboard:v2.0.1", "kubernetesui/dashboard:v2.0.1",
"kubernetesui/metrics-scraper:v1.0.4", "kubernetesui/metrics-scraper:v1.0.4",
} }
@ -36,7 +36,7 @@ func TestAuxiliary(t *testing.T) {
func TestAuxiliaryMirror(t *testing.T) { func TestAuxiliaryMirror(t *testing.T) {
want := []string{ want := []string{
"test.mirror/storage-provisioner:v1.8.1", "test.mirror/storage-provisioner:v2",
"test.mirror/dashboard:v2.0.1", "test.mirror/dashboard:v2.0.1",
"test.mirror/metrics-scraper:v1.0.4", "test.mirror/metrics-scraper:v1.0.4",
} }

View File

@ -37,7 +37,7 @@ func TestKubeadmImages(t *testing.T) {
"k8s.gcr.io/coredns:1.6.5", "k8s.gcr.io/coredns:1.6.5",
"k8s.gcr.io/etcd:3.4.3-0", "k8s.gcr.io/etcd:3.4.3-0",
"k8s.gcr.io/pause:3.1", "k8s.gcr.io/pause:3.1",
"gcr.io/k8s-minikube/storage-provisioner:v1.8.1", "gcr.io/k8s-minikube/storage-provisioner:v2",
"kubernetesui/dashboard:v2.0.1", "kubernetesui/dashboard:v2.0.1",
"kubernetesui/metrics-scraper:v1.0.4", "kubernetesui/metrics-scraper:v1.0.4",
}}, }},
@ -49,7 +49,7 @@ func TestKubeadmImages(t *testing.T) {
"mirror.k8s.io/coredns:1.6.2", "mirror.k8s.io/coredns:1.6.2",
"mirror.k8s.io/etcd:3.3.15-0", "mirror.k8s.io/etcd:3.3.15-0",
"mirror.k8s.io/pause:3.1", "mirror.k8s.io/pause:3.1",
"mirror.k8s.io/storage-provisioner:v1.8.1", "mirror.k8s.io/storage-provisioner:v2",
"mirror.k8s.io/dashboard:v2.0.1", "mirror.k8s.io/dashboard:v2.0.1",
"mirror.k8s.io/metrics-scraper:v1.0.4", "mirror.k8s.io/metrics-scraper:v1.0.4",
}}, }},
@ -61,7 +61,7 @@ func TestKubeadmImages(t *testing.T) {
"k8s.gcr.io/coredns:1.3.1", "k8s.gcr.io/coredns:1.3.1",
"k8s.gcr.io/etcd:3.3.10", "k8s.gcr.io/etcd:3.3.10",
"k8s.gcr.io/pause:3.1", "k8s.gcr.io/pause:3.1",
"gcr.io/k8s-minikube/storage-provisioner:v1.8.1", "gcr.io/k8s-minikube/storage-provisioner:v2",
"kubernetesui/dashboard:v2.0.1", "kubernetesui/dashboard:v2.0.1",
"kubernetesui/metrics-scraper:v1.0.4", "kubernetesui/metrics-scraper:v1.0.4",
}}, }},
@ -73,7 +73,7 @@ func TestKubeadmImages(t *testing.T) {
"k8s.gcr.io/coredns:1.3.1", "k8s.gcr.io/coredns:1.3.1",
"k8s.gcr.io/etcd:3.3.10", "k8s.gcr.io/etcd:3.3.10",
"k8s.gcr.io/pause:3.1", "k8s.gcr.io/pause:3.1",
"gcr.io/k8s-minikube/storage-provisioner:v1.8.1", "gcr.io/k8s-minikube/storage-provisioner:v2",
"kubernetesui/dashboard:v2.0.1", "kubernetesui/dashboard:v2.0.1",
"kubernetesui/metrics-scraper:v1.0.4", "kubernetesui/metrics-scraper:v1.0.4",
}}, }},
@ -85,7 +85,7 @@ func TestKubeadmImages(t *testing.T) {
"k8s.gcr.io/coredns:1.2.6", "k8s.gcr.io/coredns:1.2.6",
"k8s.gcr.io/etcd:3.2.24", "k8s.gcr.io/etcd:3.2.24",
"k8s.gcr.io/pause:3.1", "k8s.gcr.io/pause:3.1",
"gcr.io/k8s-minikube/storage-provisioner:v1.8.1", "gcr.io/k8s-minikube/storage-provisioner:v2",
"kubernetesui/dashboard:v2.0.1", "kubernetesui/dashboard:v2.0.1",
"kubernetesui/metrics-scraper:v1.0.4", "kubernetesui/metrics-scraper:v1.0.4",
}}, }},
@ -97,7 +97,7 @@ func TestKubeadmImages(t *testing.T) {
"k8s.gcr.io/coredns:1.2.2", "k8s.gcr.io/coredns:1.2.2",
"k8s.gcr.io/etcd:3.2.24", "k8s.gcr.io/etcd:3.2.24",
"k8s.gcr.io/pause:3.1", "k8s.gcr.io/pause:3.1",
"gcr.io/k8s-minikube/storage-provisioner:v1.8.1", "gcr.io/k8s-minikube/storage-provisioner:v2",
"kubernetesui/dashboard:v2.0.1", "kubernetesui/dashboard:v2.0.1",
"kubernetesui/metrics-scraper:v1.0.4", "kubernetesui/metrics-scraper:v1.0.4",
}}, }},

View File

@ -27,7 +27,7 @@ func TestAddRepoTagToImageName(t *testing.T) {
}{ }{
{"kubernetesui/dashboard:v2.0.1", "docker.io/kubernetesui/dashboard:v2.0.1"}, {"kubernetesui/dashboard:v2.0.1", "docker.io/kubernetesui/dashboard:v2.0.1"},
{"kubernetesui/metrics-scraper:v1.0.4", "docker.io/kubernetesui/metrics-scraper:v1.0.4"}, {"kubernetesui/metrics-scraper:v1.0.4", "docker.io/kubernetesui/metrics-scraper:v1.0.4"},
{"gcr.io/k8s-minikube/storage-provisioner:v1.8.1", "gcr.io/k8s-minikube/storage-provisioner:v1.8.1"}, {"gcr.io/k8s-minikube/storage-provisioner:v2", "gcr.io/k8s-minikube/storage-provisioner:v2"},
} }
for _, tc := range tests { for _, tc := range tests {
t.Run(tc.imgName, func(t *testing.T) { t.Run(tc.imgName, func(t *testing.T) {

View File

@ -34,6 +34,9 @@ var gitCommitID = ""
// isoVersion is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/version.isoVersion=vX.Y.Z" // isoVersion is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/version.isoVersion=vX.Y.Z"
var isoVersion = "v0.0.0-unset" var isoVersion = "v0.0.0-unset"
// storageProvisionerVersion is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/version.storageProvisionerVersion=<storage-provisioner-version>"
var storageProvisionerVersion = ""
// GetVersion returns the current minikube version // GetVersion returns the current minikube version
func GetVersion() string { func GetVersion() string {
return version return version
@ -53,3 +56,8 @@ func GetISOVersion() string {
func GetSemverVersion() (semver.Version, error) { func GetSemverVersion() (semver.Version, error) {
return semver.Make(strings.TrimPrefix(GetVersion(), VersionPrefix)) return semver.Make(strings.TrimPrefix(GetVersion(), VersionPrefix))
} }
// GetStorageProvisionerVersion returns the storage provisioner version
func GetStorageProvisionerVersion() string {
return storageProvisionerVersion
}