diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d514e530896..7e496954bc6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Release Notes +## Version 1.31.1 - 2023-07-20 + +* cni: Fix regression in auto selection [#16912](https://github.com/kubernetes/minikube/pull/16912) + +For a more detailed changelog, see [CHANGELOG.md](https://github.com/kubernetes/minikube/blob/master/CHANGELOG.md). + +Thank you to our contributors for this release! + +- Jeff MAURY +- Medya Ghazizadeh +- Steven Powell + +Thank you to our triage members for this release! + +- afbjorklund (5 comments) +- torenware (5 comments) +- mprimeaux (3 comments) +- prezha (3 comments) +- spowelljr (1 comments) + +Check out our [contributions leaderboard](https://minikube.sigs.k8s.io/docs/contrib/leaderboard/v1.31.1/) for this release! + ## Version 1.31.0 - 2023-07-18 Features: diff --git a/Makefile b/Makefile index 31cb83301234..db4f50a6767d 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ # Bump these on release - and please check ISO_VERSION for correctness. VERSION_MAJOR ?= 1 VERSION_MINOR ?= 31 -VERSION_BUILD ?= 0 +VERSION_BUILD ?= 1 RAW_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_BUILD) VERSION ?= v$(RAW_VERSION) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 4fa32dd2f099..b9f8de22fdae 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -426,11 +426,29 @@ func validateBuiltImageVersion(r command.Runner, driverName string) { return } - if versionDetails.MinikubeVersion != version.GetVersion() { + if !imageMatchesBinaryVersion(versionDetails.MinikubeVersion, version.GetVersion()) { out.WarningT("Image was not built for the current minikube version. To resolve this you can delete and recreate your minikube cluster using the latest images. Expected minikube version: {{.imageMinikubeVersion}} -> Actual minikube version: {{.minikubeVersion}}", out.V{"imageMinikubeVersion": versionDetails.MinikubeVersion, "minikubeVersion": version.GetVersion()}) } } +func imageMatchesBinaryVersion(imageVersion, binaryVersion string) bool { + // the map below is used to map the binary version to the version the image expects + // this is usually done when a patch version is released but a new ISO/Kicbase is not needed + // that way a version mismatch warning won't be thrown + // + // ex. + // the v1.31.0 and v1.31.1 minikube binaries both use v1.31.0 ISO & Kicbase + // to prevent the v1.31.1 binary from throwing a version mismatch warning we use the map to use change the binary version used in the comparison + + mappedVersions := map[string]string{ + "v1.31.1": "v1.31.0", + } + if v, ok := mappedVersions[binaryVersion]; ok { + binaryVersion = v + } + return binaryVersion == imageVersion +} + func startWithDriver(cmd *cobra.Command, starter node.Starter, existing *config.ClusterConfig) (*kubeconfig.Settings, error) { kubeconfig, err := node.Start(starter, true) if err != nil { diff --git a/cmd/minikube/cmd/start_test.go b/cmd/minikube/cmd/start_test.go index d05e91ed8482..2eed76a7f367 100644 --- a/cmd/minikube/cmd/start_test.go +++ b/cmd/minikube/cmd/start_test.go @@ -840,3 +840,23 @@ func TestValidateStaticIP(t *testing.T) { } } } + +func TestImageMatchesBinaryVersion(t *testing.T) { + tests := []struct { + imageVersion string + binaryVersion string + versionMatch bool + }{ + {"v1.17.0", "v1.17.0", true}, + {"v1.17.0", "v1.20.0", false}, + {"v1.31.0", "v1.31.1", true}, + {"v1.31.1", "v1.31.0", false}, + } + + for _, tc := range tests { + got := imageMatchesBinaryVersion(tc.imageVersion, tc.binaryVersion) + if got != tc.versionMatch { + t.Errorf("imageMatchesBinaryVersion(%s, %s) = %t; want = %t", tc.imageVersion, tc.binaryVersion, got, tc.versionMatch) + } + } +}