From 23a06f89c8a61409b0fbdcd9fbc3a96b3dc7421a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Steenis Date: Sun, 18 Aug 2019 22:04:39 +0200 Subject: [PATCH] Add new k8s versions --- apis/management.cattle.io/v3/k8s_defaults.go | 33 +++++---- .../v3/k8s_windows_default.go | 71 ++++++++++++++++++- 2 files changed, 87 insertions(+), 17 deletions(-) diff --git a/apis/management.cattle.io/v3/k8s_defaults.go b/apis/management.cattle.io/v3/k8s_defaults.go index 7f164e0b..ff3bb5eb 100644 --- a/apis/management.cattle.io/v3/k8s_defaults.go +++ b/apis/management.cattle.io/v3/k8s_defaults.go @@ -9,7 +9,7 @@ import ( ) const ( - DefaultK8s = "v1.14.5-rancher1-2" + DefaultK8s = "v1.14.6-rancher1-1" ) var ( @@ -28,9 +28,9 @@ var ( // Account for the fact that rke-tools image is different cross branches, and it requires using // different k8s version tag "v1.12.10-rancher1-1", - "v1.13.9-rancher1-4", - "v1.14.5-rancher1-2", - "v1.15.2-rancher1-2", + "v1.13.10-rancher1-2", + "v1.14.6-rancher1-1", + "v1.15.3-rancher1-1", } // K8sVersionToRKESystemImages is dynamically populated on init() with the latest versions @@ -1220,9 +1220,10 @@ var ( CoreDNS: m("coredns/coredns:1.2.6"), CoreDNSAutoscaler: m("gcr.io/google_containers/cluster-proportional-autoscaler:1.0.0"), }, - "v1.13.9-rancher1-4": { + // Enabled in Rancher v2.2.8 + "v1.13.10-rancher1-2": { Etcd: m("quay.io/coreos/etcd:v3.2.24-rancher1"), - Kubernetes: m("rancher/hyperkube:v1.13.9-rancher1"), + Kubernetes: m("rancher/hyperkube:v1.13.10-rancher1"), Alpine: m("rancher/rke-tools:v0.1.41"), NginxProxy: m("rancher/rke-tools:v0.1.41"), CertDownloader: m("rancher/rke-tools:v0.1.41"), @@ -1276,7 +1277,8 @@ var ( MetricsServer: m("gcr.io/google_containers/metrics-server:v0.3.1"), CoreDNS: "coredns/coredns:1.3.1", CoreDNSAutoscaler: m("gcr.io/google_containers/cluster-proportional-autoscaler:1.3.0"), - }, // Enabled in Rancher v2.2.3 + }, + // Enabled in Rancher v2.2.3 "v1.14.1-rancher1-2": { Etcd: m("quay.io/coreos/etcd:v3.3.10-rancher1"), Kubernetes: m("rancher/hyperkube:v1.14.1-rancher1"), @@ -1333,7 +1335,8 @@ var ( MetricsServer: m("gcr.io/google_containers/metrics-server:v0.3.1"), CoreDNS: m("coredns/coredns:1.3.1"), CoreDNSAutoscaler: m("gcr.io/google_containers/cluster-proportional-autoscaler:1.3.0"), - }, // Enabled in Rancher v2.2.7 + }, + // Enabled in Rancher v2.2.7 "v1.14.5-rancher1-1": { Etcd: m("quay.io/coreos/etcd:v3.3.10-rancher1"), Kubernetes: m("rancher/hyperkube:v1.14.5-rancher1"), @@ -1362,9 +1365,10 @@ var ( CoreDNS: m("coredns/coredns:1.3.1"), CoreDNSAutoscaler: m("gcr.io/google_containers/cluster-proportional-autoscaler:1.3.0"), }, - "v1.14.5-rancher1-2": { + // Enabled in Rancher v2.2.8 + "v1.14.6-rancher1-1": { Etcd: m("quay.io/coreos/etcd:v3.3.10-rancher1"), - Kubernetes: m("rancher/hyperkube:v1.14.5-rancher1"), + Kubernetes: m("rancher/hyperkube:v1.14.6-rancher1"), Alpine: m("rancher/rke-tools:v0.1.41"), NginxProxy: m("rancher/rke-tools:v0.1.41"), CertDownloader: m("rancher/rke-tools:v0.1.41"), @@ -1450,9 +1454,10 @@ var ( CoreDNS: m("coredns/coredns:1.3.1"), CoreDNSAutoscaler: m("gcr.io/google_containers/cluster-proportional-autoscaler:1.3.0"), }, - "v1.15.2-rancher1-2": { + // Experimental in Rancher v2.2.8 + "v1.15.3-rancher1-1": { Etcd: m("quay.io/coreos/etcd:v3.3.10-rancher1"), - Kubernetes: m("rancher/hyperkube:v1.15.2-rancher1"), + Kubernetes: m("rancher/hyperkube:v1.15.3-rancher1"), Alpine: m("rancher/rke-tools:v0.1.41"), NginxProxy: m("rancher/rke-tools:v0.1.41"), CertDownloader: m("rancher/rke-tools:v0.1.41"), @@ -1677,9 +1682,9 @@ var ( }, // k8s version from 2.1.x release with old rke-tools to allow upgrade from 2.1.x clusters // without all clusters being restarted - "v1.13.9-rancher1-3": { + "v1.13.10-rancher1-1": { Etcd: m("quay.io/coreos/etcd:v3.2.24"), - Kubernetes: m("rancher/hyperkube:v1.13.9-rancher1"), + Kubernetes: m("rancher/hyperkube:v1.13.10-rancher1"), Alpine: m("rancher/rke-tools:v0.1.16-1"), NginxProxy: m("rancher/rke-tools:v0.1.16-1"), CertDownloader: m("rancher/rke-tools:v0.1.16-1"), diff --git a/apis/management.cattle.io/v3/k8s_windows_default.go b/apis/management.cattle.io/v3/k8s_windows_default.go index d3c52f04..ddb331b1 100644 --- a/apis/management.cattle.io/v3/k8s_windows_default.go +++ b/apis/management.cattle.io/v3/k8s_windows_default.go @@ -1,5 +1,10 @@ package v3 +import ( + "strconv" + "strings" +) + var ( // K8sVersionWindowsSystemImages is dynamically populated on initWindows() with the latest versions K8sVersionWindowsSystemImages map[string]WindowsSystemImages @@ -389,9 +394,7 @@ func initWindows() { if badVersions[version] { continue } - // we stopped building Windows images at 1.12.10 (earliest previous version was 1.12.9), 1.13.9 (earliest previous version is 1.13.7), 1.14.5 (earliest previous version is 1.14.3) and 1.15.2 (earliest previous version was 1.15.0) - // existing images are still checked - if (version > "v1.12.10" && version < "v1.12.99") || (version > "v1.13.8" && version < "v1.13.99") || (version > "v1.14.4" && version < "v1.14.99") || version > "v1.15.1" { + if shouldIgnoreVersion(version) { continue } @@ -409,3 +412,65 @@ func initWindows() { } } } + +func shouldIgnoreVersion(version string) bool { + versionParts := strings.Split(version, ".") + minor := versionParts[1] + minorInt, err := strconv.Atoi(minor) + if err != nil { + panic("Can't convert string " + minor + " to int") + } + // For Rancher 2.2.x, we ignore anything below 12 + if minorInt < 12 { + return true + } + + // For Rancher 2.2.x, we stopped building Windows images at 1.12.10, so we ignore checking anything above 1.12.7 (which was the last release before 1.12.10) + if minor == "12" { + patchParts := strings.Split(versionParts[2], "-") + patch, err := strconv.Atoi(patchParts[0]) + if err != nil { + panic("Can't convert string " + patchParts[0] + " to int") + } + if patch > 7 { + return true + } + } + // For Rancher 2.2.x, we stopped building Windows images at 1.13.9, so we ignore checking anything above 1.13.5 (which was the last release before 1.13.9) + if minor == "13" { + patchParts := strings.Split(versionParts[2], "-") + patch, err := strconv.Atoi(patchParts[0]) + if err != nil { + panic("Can't convert string " + patchParts[0] + " to int") + } + if patch > 5 { + return true + } + } + // For Rancher 2.2.x, we stopped building Windows images at 1.14.5, so we ignore checking anything above 1.14.3 (which was the last release before 1.14.3) + if minor == "14" { + patchParts := strings.Split(versionParts[2], "-") + patch, err := strconv.Atoi(patchParts[0]) + if err != nil { + panic("Can't convert string " + patchParts[0] + " to int") + } + if patch > 3 { + return true + } + } + // For Rancher 2.2.x, we stopped building Windows images at 1.15.0, so we ignore checking anything above 1.15.0 + if minor == "15" { + patchParts := strings.Split(versionParts[2], "-") + patch, err := strconv.Atoi(patchParts[0]) + if err != nil { + panic("Can't convert string " + patchParts[0] + " to int") + } + if patch > 0 { + return true + } + } + if minorInt > 15 { + return true + } + return false +}