mirror of
https://github.com/siderolabs/talos.git
synced 2025-11-02 01:11:11 +01:00
feat: provide compatibility for future Talos 1.7
Ensure that Talos 1.6 machinery can handle compatibility for Talos 1.7. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
parent
131a1b1671
commit
98fd722d51
@ -15,6 +15,7 @@ import (
|
||||
"github.com/siderolabs/talos/pkg/machinery/compatibility/talos14"
|
||||
"github.com/siderolabs/talos/pkg/machinery/compatibility/talos15"
|
||||
"github.com/siderolabs/talos/pkg/machinery/compatibility/talos16"
|
||||
"github.com/siderolabs/talos/pkg/machinery/compatibility/talos17"
|
||||
)
|
||||
|
||||
// KubernetesVersion embeds Kubernetes version.
|
||||
@ -53,6 +54,8 @@ func (v *KubernetesVersion) SupportedWith(target *TalosVersion) error {
|
||||
minK8sVersion, maxK8sVersion = talos15.MinimumKubernetesVersion, talos15.MaximumKubernetesVersion
|
||||
case talos16.MajorMinor: // upgrades to 1.6.x
|
||||
minK8sVersion, maxK8sVersion = talos16.MinimumKubernetesVersion, talos16.MaximumKubernetesVersion
|
||||
case talos17.MajorMinor: // upgrades to 1.7.x
|
||||
minK8sVersion, maxK8sVersion = talos17.MinimumKubernetesVersion, talos17.MaximumKubernetesVersion
|
||||
default:
|
||||
return fmt.Errorf("compatibility with version %s is not supported", target.String())
|
||||
}
|
||||
|
||||
@ -187,12 +187,45 @@ func TestKubernetesCompatibility16(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestKubernetesCompatibility17(t *testing.T) {
|
||||
for _, tt := range []kubernetesVersionTest{
|
||||
{
|
||||
kubernetesVersion: "1.27.1",
|
||||
target: "1.7.0",
|
||||
},
|
||||
{
|
||||
kubernetesVersion: "1.25.1",
|
||||
target: "1.7.0",
|
||||
},
|
||||
{
|
||||
kubernetesVersion: "1.28.3",
|
||||
target: "1.7.0-beta.0",
|
||||
},
|
||||
{
|
||||
kubernetesVersion: "1.30.0-rc.0",
|
||||
target: "1.7.7",
|
||||
},
|
||||
{
|
||||
kubernetesVersion: "1.31.0-alpha.0",
|
||||
target: "1.7.0",
|
||||
expectedError: "version of Kubernetes 1.31.0-alpha.0 is too new to be used with Talos 1.7.0",
|
||||
},
|
||||
{
|
||||
kubernetesVersion: "1.24.1",
|
||||
target: "1.7.0",
|
||||
expectedError: "version of Kubernetes 1.24.1 is too old to be used with Talos 1.7.0",
|
||||
},
|
||||
} {
|
||||
runKubernetesVersionTest(t, tt)
|
||||
}
|
||||
}
|
||||
|
||||
func TestKubernetesCompatibilityUnsupported(t *testing.T) {
|
||||
for _, tt := range []kubernetesVersionTest{
|
||||
{
|
||||
kubernetesVersion: "1.25.0",
|
||||
target: "1.7.0-alpha.0",
|
||||
expectedError: "compatibility with version 1.7.0-alpha.0 is not supported",
|
||||
target: "1.9.0-alpha.0",
|
||||
expectedError: "compatibility with version 1.9.0-alpha.0 is not supported",
|
||||
},
|
||||
{
|
||||
kubernetesVersion: "1.25.0",
|
||||
|
||||
28
pkg/machinery/compatibility/talos17/talos17.go
Normal file
28
pkg/machinery/compatibility/talos17/talos17.go
Normal file
@ -0,0 +1,28 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
// Package talos17 provides compatibility constants for Talos 1.7.
|
||||
package talos17
|
||||
|
||||
import (
|
||||
"github.com/blang/semver/v4"
|
||||
)
|
||||
|
||||
// MajorMinor is the major.minor version of Talos 1.7.
|
||||
var MajorMinor = [2]uint64{1, 7}
|
||||
|
||||
// MinimumHostUpgradeVersion is the minimum version of Talos that can be upgraded to 1.7.
|
||||
var MinimumHostUpgradeVersion = semver.MustParse("1.4.0")
|
||||
|
||||
// MaximumHostDowngradeVersion is the maximum (not inclusive) version of Talos that can be downgraded to 1.7.
|
||||
var MaximumHostDowngradeVersion = semver.MustParse("1.9.0")
|
||||
|
||||
// DeniedHostUpgradeVersions are the versions of Talos that cannot be upgraded to 1.7.
|
||||
var DeniedHostUpgradeVersions = []semver.Version{}
|
||||
|
||||
// MinimumKubernetesVersion is the minimum version of Kubernetes is supported with 1.7.
|
||||
var MinimumKubernetesVersion = semver.MustParse("1.25.0")
|
||||
|
||||
// MaximumKubernetesVersion is the maximum version of Kubernetes is supported with 1.7.
|
||||
var MaximumKubernetesVersion = semver.MustParse("1.30.99")
|
||||
@ -16,6 +16,7 @@ import (
|
||||
"github.com/siderolabs/talos/pkg/machinery/compatibility/talos14"
|
||||
"github.com/siderolabs/talos/pkg/machinery/compatibility/talos15"
|
||||
"github.com/siderolabs/talos/pkg/machinery/compatibility/talos16"
|
||||
"github.com/siderolabs/talos/pkg/machinery/compatibility/talos17"
|
||||
)
|
||||
|
||||
// TalosVersion embeds Talos version.
|
||||
@ -51,6 +52,8 @@ func (v *TalosVersion) DisablePredictableNetworkInterfaces() bool {
|
||||
}
|
||||
|
||||
// UpgradeableFrom checks if the current version of Talos can be used as an upgrade for the given host version.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (v *TalosVersion) UpgradeableFrom(host *TalosVersion) error {
|
||||
var (
|
||||
minHostUpgradeVersion, maxHostDowngradeVersion semver.Version
|
||||
@ -73,6 +76,9 @@ func (v *TalosVersion) UpgradeableFrom(host *TalosVersion) error {
|
||||
case talos16.MajorMinor: // upgrades to 1.6.x
|
||||
minHostUpgradeVersion, maxHostDowngradeVersion = talos16.MinimumHostUpgradeVersion, talos16.MaximumHostDowngradeVersion
|
||||
deniedHostUpgradeVersions = talos16.DeniedHostUpgradeVersions
|
||||
case talos17.MajorMinor: // upgrades to 1.7.x
|
||||
minHostUpgradeVersion, maxHostDowngradeVersion = talos17.MinimumHostUpgradeVersion, talos17.MaximumHostDowngradeVersion
|
||||
deniedHostUpgradeVersions = talos17.DeniedHostUpgradeVersions
|
||||
default:
|
||||
return fmt.Errorf("upgrades to version %s are not supported", v.version.String())
|
||||
}
|
||||
|
||||
@ -204,6 +204,47 @@ func TestTalosUpgradeCompatibility16(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTalosUpgradeCompatibility17(t *testing.T) {
|
||||
for _, tt := range []talosVersionTest{
|
||||
{
|
||||
host: "1.5.0",
|
||||
target: "1.7.0",
|
||||
},
|
||||
{
|
||||
host: "1.4.0-alpha.0",
|
||||
target: "1.7.0",
|
||||
},
|
||||
{
|
||||
host: "1.4.0",
|
||||
target: "1.7.0-alpha.0",
|
||||
},
|
||||
{
|
||||
host: "1.6.0",
|
||||
target: "1.7.1",
|
||||
},
|
||||
{
|
||||
host: "1.6.0-beta.0",
|
||||
target: "1.7.0",
|
||||
},
|
||||
{
|
||||
host: "1.8.5",
|
||||
target: "1.7.3",
|
||||
},
|
||||
{
|
||||
host: "1.3.0",
|
||||
target: "1.7.0",
|
||||
expectedError: `host version 1.3.0 is too old to upgrade to Talos 1.7.0`,
|
||||
},
|
||||
{
|
||||
host: "1.9.0-alpha.0",
|
||||
target: "1.7.0",
|
||||
expectedError: `host version 1.9.0-alpha.0 is too new to downgrade to Talos 1.7.0`,
|
||||
},
|
||||
} {
|
||||
runTalosVersionTest(t, tt)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTalosUpgradeCompatibilityUnsupported(t *testing.T) {
|
||||
for _, tt := range []talosVersionTest{
|
||||
{
|
||||
@ -213,8 +254,8 @@ func TestTalosUpgradeCompatibilityUnsupported(t *testing.T) {
|
||||
},
|
||||
{
|
||||
host: "1.4.0",
|
||||
target: "1.7.0-alpha.0",
|
||||
expectedError: `upgrades to version 1.7.0-alpha.0 are not supported`,
|
||||
target: "1.9.0-alpha.0",
|
||||
expectedError: `upgrades to version 1.9.0-alpha.0 are not supported`,
|
||||
},
|
||||
} {
|
||||
runTalosVersionTest(t, tt)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user