kubeadm: make sure we only track >= 3 etcd versions at at time

There is no point to track more than 3 etcd versions at a time
where each etcd versions maps to a k8s CP version.

It's 3 instead of 2 (k8s CP / kubeadm version skew size) because
there is a period of time where the 3rd version (newest) will
be WIP at k/k master - e.g. at the time of this commit it's 1.31.

Add a unit test to block on this.

Also fixate the min etcd version to 3.5.11.
This commit is contained in:
Lubomir I. Ivanov 2024-04-23 10:27:40 +03:00
parent 695a984f56
commit a04cc020f1
2 changed files with 9 additions and 12 deletions

View File

@ -317,7 +317,7 @@ const (
KubeletHealthzPort = 10248 KubeletHealthzPort = 10248
// MinExternalEtcdVersion indicates minimum external etcd version which kubeadm supports // MinExternalEtcdVersion indicates minimum external etcd version which kubeadm supports
MinExternalEtcdVersion = "3.4.13-4" MinExternalEtcdVersion = "3.5.11-0"
// DefaultEtcdVersion indicates the default etcd version that kubeadm uses // DefaultEtcdVersion indicates the default etcd version that kubeadm uses
DefaultEtcdVersion = "3.5.13-0" DefaultEtcdVersion = "3.5.13-0"
@ -479,13 +479,6 @@ var (
// SupportedEtcdVersion lists officially supported etcd versions with corresponding Kubernetes releases // SupportedEtcdVersion lists officially supported etcd versions with corresponding Kubernetes releases
SupportedEtcdVersion = map[uint8]string{ SupportedEtcdVersion = map[uint8]string{
22: "3.5.13-0",
23: "3.5.13-0",
24: "3.5.13-0",
25: "3.5.13-0",
26: "3.5.13-0",
27: "3.5.13-0",
28: "3.5.13-0",
29: "3.5.13-0", 29: "3.5.13-0",
30: "3.5.13-0", 30: "3.5.13-0",
31: "3.5.13-0", 31: "3.5.13-0",

View File

@ -124,11 +124,15 @@ func TestGetStaticPodFilepath(t *testing.T) {
} }
} }
func TestEtcdSupportedVersionLength(t *testing.T) {
const max = 3
if len(SupportedEtcdVersion) > max {
t.Fatalf("SupportedEtcdVersion must not include more than %d versions", max)
}
}
func TestEtcdSupportedVersion(t *testing.T) { func TestEtcdSupportedVersion(t *testing.T) {
var supportedEtcdVersion = map[uint8]string{ var supportedEtcdVersion = map[uint8]string{
13: "3.2.24",
14: "3.3.10",
15: "3.3.10",
16: "3.3.17-0", 16: "3.3.17-0",
17: "3.4.3-0", 17: "3.4.3-0",
18: "3.4.3-0", 18: "3.4.3-0",
@ -147,7 +151,7 @@ func TestEtcdSupportedVersion(t *testing.T) {
}, },
{ {
kubernetesVersion: "1.10.1", kubernetesVersion: "1.10.1",
expectedVersion: version.MustParseSemantic("3.2.24"), expectedVersion: version.MustParseSemantic("3.3.17-0"),
expectedWarning: true, expectedWarning: true,
expectedError: false, expectedError: false,
}, },