test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
// 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/.
// +build integration_provision
package provision
import (
"context"
2020-10-23 23:59:50 +03:00
"encoding/json"
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
"fmt"
"net"
"os"
"path/filepath"
"strings"
"time"
"github.com/stretchr/testify/suite"
2021-02-20 17:07:38 +03:00
"github.com/talos-systems/go-blockdevice/blockdevice/encryption"
2020-09-02 20:14:25 +03:00
"github.com/talos-systems/go-retry/retry"
2020-08-14 18:57:15 +03:00
talosnet "github.com/talos-systems/net"
2020-10-23 23:59:50 +03:00
corev1 "k8s.io/api/core/v1"
2020-09-07 23:36:42 +03:00
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2020-10-23 23:59:50 +03:00
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/strategicpatch"
2020-08-14 18:57:15 +03:00
2020-03-20 17:38:48 -07:00
"github.com/talos-systems/talos/cmd/talosctl/pkg/mgmt/helpers"
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
"github.com/talos-systems/talos/internal/integration/base"
2020-08-12 00:05:35 +03:00
"github.com/talos-systems/talos/pkg/cluster/check"
2020-09-10 23:43:50 +03:00
"github.com/talos-systems/talos/pkg/cluster/kubernetes"
2020-09-07 23:36:42 +03:00
"github.com/talos-systems/talos/pkg/cluster/sonobuoy"
2020-09-25 07:27:20 -07:00
"github.com/talos-systems/talos/pkg/images"
2020-08-17 19:12:47 +03:00
machineapi "github.com/talos-systems/talos/pkg/machinery/api/machine"
talosclient "github.com/talos-systems/talos/pkg/machinery/client"
2020-09-07 23:36:42 +03:00
clientconfig "github.com/talos-systems/talos/pkg/machinery/client/config"
2021-02-09 23:50:39 +03:00
"github.com/talos-systems/talos/pkg/machinery/config"
2020-08-17 19:12:47 +03:00
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/bundle"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/generate"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
"github.com/talos-systems/talos/pkg/machinery/constants"
2020-08-12 00:05:35 +03:00
"github.com/talos-systems/talos/pkg/provision"
"github.com/talos-systems/talos/pkg/provision/access"
"github.com/talos-systems/talos/pkg/provision/providers/qemu"
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
)
2021-03-05 11:52:08 +03:00
//nolint:maligned
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
type upgradeSpec struct {
ShortName string
SourceKernelPath string
SourceInitramfsPath string
SourceInstallerImage string
SourceVersion string
2020-09-10 23:43:50 +03:00
SourceK8sVersion string
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
TargetInstallerImage string
TargetVersion string
2020-09-07 23:36:42 +03:00
TargetK8sVersion string
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
MasterNodes int
WorkerNodes int
2020-03-24 21:20:36 +03:00
UpgradePreserve bool
2020-12-03 23:56:00 +03:00
UpgradeStage bool
2021-02-20 17:07:38 +03:00
WithEncryption bool
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
}
const (
2021-05-13 16:07:59 +03:00
previousRelease = "v0.9.3"
stableRelease = "v0.10.1" // or soon-to-be-stable
2021-03-22 18:56:44 +03:00
// The current version (the one being built on CI) is DefaultSettings.CurrentVersion.
2020-09-07 23:36:42 +03:00
2021-05-13 16:07:59 +03:00
previousK8sVersion = "1.20.6" // constants.DefaultKubernetesVersion in the previousRelease
stableK8sVersion = "1.21.0" // constants.DefaultKubernetesVersion in the stableRelease
currentK8sVersion = "1.21.1" // next k8s version being tested
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
)
2021-03-12 17:40:17 +03:00
var defaultNameservers = [ ] net . IP { net . ParseIP ( "8.8.8.8" ) , net . ParseIP ( "1.1.1.1" ) }
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
2021-03-22 18:56:44 +03:00
// upgradePreviousToStable upgrades from the previous Talos release to the stable release.
func upgradePreviousToStable ( ) upgradeSpec {
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
return upgradeSpec {
2020-11-18 00:30:50 +03:00
ShortName : fmt . Sprintf ( "%s-%s" , previousRelease , stableRelease ) ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
2020-12-10 22:41:54 +03:00
SourceKernelPath : helpers . ArtifactPath ( filepath . Join ( trimVersion ( previousRelease ) , constants . KernelAsset ) ) ,
SourceInitramfsPath : helpers . ArtifactPath ( filepath . Join ( trimVersion ( previousRelease ) , constants . InitramfsAsset ) ) ,
SourceInstallerImage : fmt . Sprintf ( "%s:%s" , "ghcr.io/talos-systems/installer" , previousRelease ) ,
2020-11-18 00:30:50 +03:00
SourceVersion : previousRelease ,
SourceK8sVersion : previousK8sVersion ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
2020-11-18 00:30:50 +03:00
TargetInstallerImage : fmt . Sprintf ( "%s:%s" , "ghcr.io/talos-systems/installer" , stableRelease ) ,
TargetVersion : stableRelease ,
TargetK8sVersion : stableK8sVersion ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
MasterNodes : DefaultSettings . MasterNodes ,
WorkerNodes : DefaultSettings . WorkerNodes ,
}
}
2021-03-22 18:56:44 +03:00
// upgradeStableToCurrent upgrades from the stable Talos release to the current version.
func upgradeStableToCurrent ( ) upgradeSpec {
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
return upgradeSpec {
2020-11-18 00:30:50 +03:00
ShortName : fmt . Sprintf ( "%s-%s" , stableRelease , DefaultSettings . CurrentVersion ) ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
2020-11-18 00:30:50 +03:00
SourceKernelPath : helpers . ArtifactPath ( filepath . Join ( trimVersion ( stableRelease ) , constants . KernelAsset ) ) ,
SourceInitramfsPath : helpers . ArtifactPath ( filepath . Join ( trimVersion ( stableRelease ) , constants . InitramfsAsset ) ) ,
SourceInstallerImage : fmt . Sprintf ( "%s:%s" , "ghcr.io/talos-systems/installer" , stableRelease ) ,
SourceVersion : stableRelease ,
2020-10-23 23:59:50 +03:00
SourceK8sVersion : stableK8sVersion ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
2020-09-25 20:26:01 +03:00
TargetInstallerImage : fmt . Sprintf ( "%s/%s:%s" , DefaultSettings . TargetInstallImageRegistry , images . DefaultInstallerImageName , DefaultSettings . CurrentVersion ) ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
TargetVersion : DefaultSettings . CurrentVersion ,
2021-02-20 20:00:22 +03:00
TargetK8sVersion : currentK8sVersion ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
MasterNodes : DefaultSettings . MasterNodes ,
WorkerNodes : DefaultSettings . WorkerNodes ,
}
}
2021-03-22 18:56:44 +03:00
// upgradeCurrentToCurrent upgrades the current version to itself.
func upgradeCurrentToCurrent ( ) upgradeSpec {
2021-02-20 17:07:38 +03:00
installerImage := fmt . Sprintf ( "%s/%s:%s" , DefaultSettings . TargetInstallImageRegistry , images . DefaultInstallerImageName , DefaultSettings . CurrentVersion )
return upgradeSpec {
ShortName : fmt . Sprintf ( "%s-%s" , DefaultSettings . CurrentVersion , DefaultSettings . CurrentVersion ) ,
SourceKernelPath : helpers . ArtifactPath ( constants . KernelAssetWithArch ) ,
SourceInitramfsPath : helpers . ArtifactPath ( constants . InitramfsAssetWithArch ) ,
SourceInstallerImage : installerImage ,
SourceVersion : DefaultSettings . CurrentVersion ,
SourceK8sVersion : currentK8sVersion ,
TargetInstallerImage : installerImage ,
TargetVersion : DefaultSettings . CurrentVersion ,
TargetK8sVersion : currentK8sVersion ,
MasterNodes : DefaultSettings . MasterNodes ,
WorkerNodes : DefaultSettings . WorkerNodes ,
WithEncryption : true ,
}
}
2021-03-22 18:56:44 +03:00
// upgradeStableToCurrentPreserve upgrades from the stable Talos release to the current version for single-node cluster with preserve.
func upgradeStableToCurrentPreserve ( ) upgradeSpec {
2020-03-24 21:20:36 +03:00
return upgradeSpec {
2021-02-09 22:48:18 +03:00
ShortName : fmt . Sprintf ( "prsrv-%s-%s" , stableRelease , DefaultSettings . CurrentVersion ) ,
2020-03-24 21:20:36 +03:00
2020-11-18 00:30:50 +03:00
SourceKernelPath : helpers . ArtifactPath ( filepath . Join ( trimVersion ( stableRelease ) , constants . KernelAsset ) ) ,
SourceInitramfsPath : helpers . ArtifactPath ( filepath . Join ( trimVersion ( stableRelease ) , constants . InitramfsAsset ) ) ,
SourceInstallerImage : fmt . Sprintf ( "%s:%s" , "ghcr.io/talos-systems/installer" , stableRelease ) ,
SourceVersion : stableRelease ,
2020-10-23 23:59:50 +03:00
SourceK8sVersion : stableK8sVersion ,
2020-03-24 21:20:36 +03:00
2020-09-25 07:27:20 -07:00
TargetInstallerImage : fmt . Sprintf ( "%s/%s:%s" , DefaultSettings . TargetInstallImageRegistry , images . DefaultInstallerImageName , DefaultSettings . CurrentVersion ) ,
2020-03-24 21:20:36 +03:00
TargetVersion : DefaultSettings . CurrentVersion ,
2021-02-20 20:00:22 +03:00
TargetK8sVersion : currentK8sVersion ,
2020-03-24 21:20:36 +03:00
MasterNodes : 1 ,
WorkerNodes : 0 ,
UpgradePreserve : true ,
}
}
2021-03-22 18:56:44 +03:00
// upgradeStableToCurrentPreserveStage upgrades from the stable Talos release to the current version for single-node cluster with preserve and stage.
func upgradeStableToCurrentPreserveStage ( ) upgradeSpec {
2020-12-03 23:56:00 +03:00
return upgradeSpec {
2021-02-09 22:48:18 +03:00
ShortName : fmt . Sprintf ( "prsrv-stg-%s-%s" , stableRelease , DefaultSettings . CurrentVersion ) ,
2020-12-03 23:56:00 +03:00
2020-12-10 22:41:54 +03:00
SourceKernelPath : helpers . ArtifactPath ( filepath . Join ( trimVersion ( stableRelease ) , constants . KernelAsset ) ) ,
SourceInitramfsPath : helpers . ArtifactPath ( filepath . Join ( trimVersion ( stableRelease ) , constants . InitramfsAsset ) ) ,
SourceInstallerImage : fmt . Sprintf ( "%s:%s" , "ghcr.io/talos-systems/installer" , stableRelease ) ,
SourceVersion : stableRelease ,
SourceK8sVersion : stableK8sVersion ,
2020-12-03 23:56:00 +03:00
TargetInstallerImage : fmt . Sprintf ( "%s/%s:%s" , DefaultSettings . TargetInstallImageRegistry , images . DefaultInstallerImageName , DefaultSettings . CurrentVersion ) ,
TargetVersion : DefaultSettings . CurrentVersion ,
2021-02-20 20:00:22 +03:00
TargetK8sVersion : currentK8sVersion ,
2020-12-03 23:56:00 +03:00
MasterNodes : 1 ,
WorkerNodes : 0 ,
UpgradePreserve : true ,
UpgradeStage : true ,
}
}
2020-10-19 21:18:25 +03:00
// UpgradeSuite ...
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
type UpgradeSuite struct {
suite . Suite
base . TalosSuite
specGen func ( ) upgradeSpec
spec upgradeSpec
2020-03-24 21:20:36 +03:00
track int
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
provisioner provision . Provisioner
configBundle * v1alpha1 . ConfigBundle
2020-11-23 18:13:17 +03:00
clusterAccess * access . Adapter
controlPlaneEndpoint string
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
ctx context . Context
ctxCancel context . CancelFunc
stateDir string
2021-03-12 17:40:17 +03:00
cniDir string
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
}
// SetupSuite ...
func ( suite * UpgradeSuite ) SetupSuite ( ) {
// call generate late in the flow, as it needs to pick up settings overridden by test runner
suite . spec = suite . specGen ( )
suite . T ( ) . Logf ( "upgrade spec = %v" , suite . spec )
// timeout for the whole test
suite . ctx , suite . ctxCancel = context . WithTimeout ( context . Background ( ) , 30 * time . Minute )
var err error
2020-07-30 21:44:10 +03:00
suite . provisioner , err = qemu . NewProvisioner ( suite . ctx )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
suite . Require ( ) . NoError ( err )
}
// TearDownSuite ...
func ( suite * UpgradeSuite ) TearDownSuite ( ) {
2020-10-23 23:59:50 +03:00
if suite . T ( ) . Failed ( ) && DefaultSettings . CrashdumpEnabled && suite . Cluster != nil {
2020-02-21 21:58:30 +03:00
// for failed tests, produce crash dump for easier debugging,
// as cluster is going to be torn down below
suite . provisioner . CrashDump ( suite . ctx , suite . Cluster , os . Stderr )
2020-03-24 21:20:36 +03:00
if suite . clusterAccess != nil {
suite . clusterAccess . CrashDump ( suite . ctx , os . Stderr )
}
2020-02-21 21:58:30 +03:00
}
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
if suite . clusterAccess != nil {
suite . Assert ( ) . NoError ( suite . clusterAccess . Close ( ) )
}
if suite . Cluster != nil {
suite . Assert ( ) . NoError ( suite . provisioner . Destroy ( suite . ctx , suite . Cluster ) )
}
suite . ctxCancel ( )
if suite . stateDir != "" {
suite . Assert ( ) . NoError ( os . RemoveAll ( suite . stateDir ) )
}
if suite . provisioner != nil {
suite . Assert ( ) . NoError ( suite . provisioner . Close ( ) )
}
}
2020-06-30 17:25:53 +03:00
// setupCluster provisions source clusters and waits for health.
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
func ( suite * UpgradeSuite ) setupCluster ( ) {
2020-10-23 23:59:50 +03:00
defaultStateDir , err := clientconfig . GetTalosDirectory ( )
suite . Require ( ) . NoError ( err )
suite . stateDir = filepath . Join ( defaultStateDir , "clusters" )
2021-03-12 17:40:17 +03:00
suite . cniDir = filepath . Join ( defaultStateDir , "cni" )
2020-10-23 23:59:50 +03:00
clusterName := suite . spec . ShortName
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
_ , cidr , err := net . ParseCIDR ( DefaultSettings . CIDR )
suite . Require ( ) . NoError ( err )
var gatewayIP net . IP
gatewayIP , err = talosnet . NthIPInNetwork ( cidr , 1 )
suite . Require ( ) . NoError ( err )
ips := make ( [ ] net . IP , suite . spec . MasterNodes + suite . spec . WorkerNodes )
for i := range ips {
ips [ i ] , err = talosnet . NthIPInNetwork ( cidr , i + 2 )
suite . Require ( ) . NoError ( err )
}
2020-10-19 21:18:25 +03:00
suite . T ( ) . Logf ( "initializing provisioner with cluster name %q, state directory %q" , clusterName , suite . stateDir )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
request := provision . ClusterRequest {
Name : clusterName ,
Network : provision . NetworkRequest {
2021-02-08 16:41:32 +03:00
Name : clusterName ,
CIDRs : [ ] net . IPNet { * cidr } ,
GatewayAddrs : [ ] net . IP { gatewayIP } ,
MTU : DefaultSettings . MTU ,
Nameservers : defaultNameservers ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
CNI : provision . CNIConfig {
2021-03-12 17:40:17 +03:00
BinPath : [ ] string { filepath . Join ( suite . cniDir , "bin" ) } ,
ConfDir : filepath . Join ( suite . cniDir , "conf.d" ) ,
CacheDir : filepath . Join ( suite . cniDir , "cache" ) ,
BundleURL : DefaultSettings . CNIBundleURL ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
} ,
} ,
KernelPath : suite . spec . SourceKernelPath ,
InitramfsPath : suite . spec . SourceInitramfsPath ,
2020-03-24 21:20:36 +03:00
SelfExecutable : suite . TalosctlPath ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
StateDirectory : suite . stateDir ,
}
2020-07-08 21:33:19 +03:00
defaultInternalLB , _ := suite . provisioner . GetLoadBalancers ( request . Network )
2020-11-23 18:13:17 +03:00
suite . controlPlaneEndpoint = fmt . Sprintf ( "https://%s:%d" , defaultInternalLB , constants . DefaultControlPlanePort )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
genOptions := suite . provisioner . GenOptions ( request . Network )
for _ , registryMirror := range DefaultSettings . RegistryMirrors {
parts := strings . SplitN ( registryMirror , "=" , 2 )
suite . Require ( ) . Len ( parts , 2 )
genOptions = append ( genOptions , generate . WithRegistryMirror ( parts [ 0 ] , parts [ 1 ] ) )
}
2020-07-08 21:33:19 +03:00
masterEndpoints := make ( [ ] string , suite . spec . MasterNodes )
for i := range masterEndpoints {
masterEndpoints [ i ] = ips [ i ] . String ( )
}
2020-09-07 23:36:42 +03:00
if DefaultSettings . CustomCNIURL != "" {
genOptions = append ( genOptions , generate . WithClusterCNIConfig ( & v1alpha1 . CNIConfig {
2021-04-09 14:03:40 +00:00
CNIName : constants . CustomCNI ,
2020-09-07 23:36:42 +03:00
CNIUrls : [ ] string { DefaultSettings . CustomCNIURL } ,
} ) )
}
2021-02-20 17:07:38 +03:00
if suite . spec . WithEncryption {
genOptions = append ( genOptions , generate . WithSystemDiskEncryption ( & v1alpha1 . SystemDiskEncryptionConfig {
StatePartition : & v1alpha1 . EncryptionConfig {
EncryptionProvider : encryption . LUKS2 ,
EncryptionKeys : [ ] * v1alpha1 . EncryptionKey {
{
KeyNodeID : & v1alpha1 . EncryptionKeyNodeID { } ,
KeySlot : 0 ,
} ,
} ,
} ,
EphemeralPartition : & v1alpha1 . EncryptionConfig {
EncryptionProvider : encryption . LUKS2 ,
EncryptionKeys : [ ] * v1alpha1 . EncryptionKey {
{
KeyNodeID : & v1alpha1 . EncryptionKeyNodeID { } ,
KeySlot : 0 ,
} ,
} ,
} ,
} ) )
}
2021-02-09 23:50:39 +03:00
versionContract , err := config . ParseContractFromVersion ( suite . spec . SourceVersion )
suite . Require ( ) . NoError ( err )
2020-07-28 21:48:26 +03:00
suite . configBundle , err = bundle . NewConfigBundle ( bundle . WithInputOptions (
& bundle . InputOptions {
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
ClusterName : clusterName ,
2020-11-23 18:13:17 +03:00
Endpoint : suite . controlPlaneEndpoint ,
2021-03-19 20:50:25 +03:00
KubeVersion : suite . spec . SourceK8sVersion ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
GenOptions : append (
genOptions ,
2020-07-08 21:33:19 +03:00
generate . WithEndpointList ( masterEndpoints ) ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
generate . WithInstallImage ( suite . spec . SourceInstallerImage ) ,
2020-09-07 23:36:42 +03:00
generate . WithDNSDomain ( "cluster.local" ) ,
2021-02-09 23:50:39 +03:00
generate . WithVersionContract ( versionContract ) ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
) ,
} ) )
suite . Require ( ) . NoError ( err )
for i := 0 ; i < suite . spec . MasterNodes ; i ++ {
request . Nodes = append ( request . Nodes ,
provision . NodeRequest {
Name : fmt . Sprintf ( "master-%d" , i + 1 ) ,
2020-11-09 23:10:19 +03:00
Type : machine . TypeControlPlane ,
2021-02-08 16:41:32 +03:00
IPs : [ ] net . IP { ips [ i ] } ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
Memory : DefaultSettings . MemMB * 1024 * 1024 ,
NanoCPUs : DefaultSettings . CPUs * 1000 * 1000 * 1000 ,
2020-10-29 19:19:31 +03:00
Disks : [ ] * provision . Disk {
{
Size : DefaultSettings . DiskGB * 1024 * 1024 * 1024 ,
} ,
} ,
Config : suite . configBundle . ControlPlane ( ) ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
} )
}
for i := 1 ; i <= suite . spec . WorkerNodes ; i ++ {
request . Nodes = append ( request . Nodes ,
provision . NodeRequest {
Name : fmt . Sprintf ( "worker-%d" , i ) ,
2020-11-09 23:10:19 +03:00
Type : machine . TypeJoin ,
2021-02-08 16:41:32 +03:00
IPs : [ ] net . IP { ips [ suite . spec . MasterNodes + i - 1 ] } ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
Memory : DefaultSettings . MemMB * 1024 * 1024 ,
NanoCPUs : DefaultSettings . CPUs * 1000 * 1000 * 1000 ,
2020-10-29 19:19:31 +03:00
Disks : [ ] * provision . Disk {
{
Size : DefaultSettings . DiskGB * 1024 * 1024 * 1024 ,
} ,
} ,
Config : suite . configBundle . Join ( ) ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
} )
}
2020-07-29 19:39:47 +03:00
suite . Cluster , err = suite . provisioner . Create ( suite . ctx , request , provision . WithBootlader ( true ) , provision . WithTalosConfig ( suite . configBundle . TalosConfig ( ) ) )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
suite . Require ( ) . NoError ( err )
2020-09-07 23:36:42 +03:00
defaultTalosConfig , err := clientconfig . GetDefaultPath ( )
suite . Require ( ) . NoError ( err )
c , err := clientconfig . Open ( defaultTalosConfig )
suite . Require ( ) . NoError ( err )
c . Merge ( suite . configBundle . TalosConfig ( ) )
suite . Require ( ) . NoError ( c . Save ( defaultTalosConfig ) )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
suite . clusterAccess = access . NewAdapter ( suite . Cluster , provision . WithTalosConfig ( suite . configBundle . TalosConfig ( ) ) )
2020-10-23 23:59:50 +03:00
suite . Require ( ) . NoError ( suite . clusterAccess . Bootstrap ( suite . ctx , os . Stdout ) )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
suite . waitForClusterHealth ( )
}
2020-06-30 17:25:53 +03:00
// waitForClusterHealth asserts cluster health after any change.
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
func ( suite * UpgradeSuite ) waitForClusterHealth ( ) {
2020-12-10 22:41:54 +03:00
runs := 1
singleNodeCluster := len ( suite . Cluster . Info ( ) . Nodes ) == 1
if singleNodeCluster {
// run health check several times for single node clusters,
// as self-hosted control plane is not stable after reboot
runs = 3
}
for run := 0 ; run < runs ; run ++ {
if run > 0 {
time . Sleep ( 15 * time . Second )
}
2021-02-16 22:50:18 +03:00
checkCtx , checkCtxCancel := context . WithTimeout ( suite . ctx , 15 * time . Minute )
2020-12-10 22:41:54 +03:00
defer checkCtxCancel ( )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
2020-12-10 22:41:54 +03:00
suite . Require ( ) . NoError ( check . Wait ( checkCtx , suite . clusterAccess , check . DefaultClusterChecks ( ) , check . StderrReporter ( ) ) )
}
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
}
2020-09-07 23:36:42 +03:00
// runE2E runs e2e test on the cluster.
func ( suite * UpgradeSuite ) runE2E ( k8sVersion string ) {
2020-10-23 23:59:50 +03:00
if suite . spec . WorkerNodes == 0 {
// no worker nodes, should make masters schedulable
suite . untaint ( "master-1" )
}
2020-09-07 23:36:42 +03:00
options := sonobuoy . DefaultOptions ( )
options . KubernetesVersion = k8sVersion
suite . Assert ( ) . NoError ( sonobuoy . Run ( suite . ctx , suite . clusterAccess , options ) )
}
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
func ( suite * UpgradeSuite ) assertSameVersionCluster ( client * talosclient . Client , expectedVersion string ) {
nodes := make ( [ ] string , len ( suite . Cluster . Info ( ) . Nodes ) )
for i , node := range suite . Cluster . Info ( ) . Nodes {
2021-02-08 16:41:32 +03:00
nodes [ i ] = node . IPs [ 0 ] . String ( )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
}
ctx := talosclient . WithNodes ( suite . ctx , nodes ... )
var v * machineapi . VersionResponse
err := retry . Constant (
time . Minute ,
) . Retry ( func ( ) error {
var e error
v , e = client . Version ( ctx )
return retry . ExpectedError ( e )
} )
suite . Require ( ) . NoError ( err )
suite . Require ( ) . Len ( v . Messages , len ( nodes ) )
for _ , version := range v . Messages {
suite . Assert ( ) . Equal ( expectedVersion , version . Version . Tag )
}
}
2020-10-19 21:18:25 +03:00
func ( suite * UpgradeSuite ) readVersion ( nodeCtx context . Context , client * talosclient . Client ) ( version string , err error ) {
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
var v * machineapi . VersionResponse
v , err = client . Version ( nodeCtx )
if err != nil {
return
}
version = v . Messages [ 0 ] . Version . Tag
return
}
func ( suite * UpgradeSuite ) upgradeNode ( client * talosclient . Client , node provision . NodeInfo ) {
2021-02-08 16:41:32 +03:00
suite . T ( ) . Logf ( "upgrading node %s" , node . IPs [ 0 ] )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
2021-02-08 16:41:32 +03:00
nodeCtx := talosclient . WithNodes ( suite . ctx , node . IPs [ 0 ] . String ( ) )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
2021-02-09 22:48:18 +03:00
var (
resp * machineapi . UpgradeResponse
err error
)
err = retry . Constant ( time . Minute , retry . WithUnits ( 10 * time . Second ) ) . Retry ( func ( ) error {
resp , err = client . Upgrade ( nodeCtx , suite . spec . TargetInstallerImage , suite . spec . UpgradePreserve , suite . spec . UpgradeStage , false )
if err != nil {
if strings . Contains ( err . Error ( ) , "leader changed" ) {
return retry . ExpectedError ( err )
}
return retry . UnexpectedError ( err )
}
return nil
} )
2020-12-03 23:56:00 +03:00
2020-12-10 22:41:54 +03:00
err = base . IgnoreGRPCUnavailable ( err )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
suite . Require ( ) . NoError ( err )
2020-12-03 23:56:00 +03:00
if resp != nil {
suite . Require ( ) . Equal ( "Upgrade request received" , resp . Messages [ 0 ] . Ack )
}
// wait for the upgrade to be kicked off
time . Sleep ( 10 * time . Second )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
// wait for the version to be equal to target version
2020-07-30 22:59:13 +03:00
suite . Require ( ) . NoError ( retry . Constant ( 10 * time . Minute ) . Retry ( func ( ) error {
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
var version string
2020-10-19 21:18:25 +03:00
version , err = suite . readVersion ( nodeCtx , client )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
if err != nil {
// API might be unresponsive during upgrade
return retry . ExpectedError ( err )
}
if version != suite . spec . TargetVersion {
// upgrade not finished yet
2021-02-08 16:41:32 +03:00
return retry . ExpectedError ( fmt . Errorf ( "node %q version doesn't match expected: expected %q, got %q" , node . IPs [ 0 ] . String ( ) , suite . spec . TargetVersion , version ) )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
}
return nil
} ) )
suite . waitForClusterHealth ( )
}
2020-09-10 23:43:50 +03:00
func ( suite * UpgradeSuite ) upgradeKubernetes ( fromVersion , toVersion string ) {
if fromVersion == toVersion {
suite . T ( ) . Logf ( "skipping Kubernetes upgrade, as versions are equal %q -> %q" , fromVersion , toVersion )
return
}
suite . T ( ) . Logf ( "upgrading Kubernetes: %q -> %q" , fromVersion , toVersion )
2021-02-09 22:48:18 +03:00
options := kubernetes . UpgradeOptions {
2020-11-23 18:13:17 +03:00
FromVersion : fromVersion ,
ToVersion : toVersion ,
ControlPlaneEndpoint : suite . controlPlaneEndpoint ,
2021-02-09 22:48:18 +03:00
}
2021-04-09 20:48:49 +03:00
suite . Require ( ) . NoError ( kubernetes . UpgradeTalosManaged ( suite . ctx , suite . clusterAccess , options ) )
2020-09-10 23:43:50 +03:00
}
2020-10-23 23:59:50 +03:00
func ( suite * UpgradeSuite ) untaint ( name string ) {
client , err := suite . clusterAccess . K8sClient ( suite . ctx )
suite . Require ( ) . NoError ( err )
n , err := client . CoreV1 ( ) . Nodes ( ) . Get ( suite . ctx , name , metav1 . GetOptions { } )
suite . Require ( ) . NoError ( err )
oldData , err := json . Marshal ( n )
suite . Require ( ) . NoError ( err )
k := 0
for _ , taint := range n . Spec . Taints {
if taint . Key != constants . LabelNodeRoleMaster {
n . Spec . Taints [ k ] = taint
k ++
}
}
n . Spec . Taints = n . Spec . Taints [ : k ]
newData , err := json . Marshal ( n )
suite . Require ( ) . NoError ( err )
patchBytes , err := strategicpatch . CreateTwoWayMergePatch ( oldData , newData , corev1 . Node { } )
suite . Require ( ) . NoError ( err )
_ , err = client . CoreV1 ( ) . Nodes ( ) . Patch ( suite . ctx , n . Name , types . StrategicMergePatchType , patchBytes , metav1 . PatchOptions { } )
suite . Require ( ) . NoError ( err )
}
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
// TestRolling performs rolling upgrade starting with master nodes.
func ( suite * UpgradeSuite ) TestRolling ( ) {
suite . setupCluster ( )
client , err := suite . clusterAccess . Client ( )
suite . Require ( ) . NoError ( err )
// verify initial cluster version
suite . assertSameVersionCluster ( client , suite . spec . SourceVersion )
// upgrade master nodes
for _ , node := range suite . Cluster . Info ( ) . Nodes {
2020-07-28 21:48:26 +03:00
if node . Type == machine . TypeInit || node . Type == machine . TypeControlPlane {
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
suite . upgradeNode ( client , node )
}
}
// upgrade worker nodes
for _ , node := range suite . Cluster . Info ( ) . Nodes {
2020-07-28 21:48:26 +03:00
if node . Type == machine . TypeJoin {
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
suite . upgradeNode ( client , node )
}
}
// verify final cluster version
suite . assertSameVersionCluster ( client , suite . spec . TargetVersion )
2020-09-07 23:36:42 +03:00
2021-02-09 22:48:18 +03:00
// upgrade Kubernetes if required
suite . upgradeKubernetes ( suite . spec . SourceK8sVersion , suite . spec . TargetK8sVersion )
2020-09-07 23:36:42 +03:00
// run e2e test
suite . runE2E ( suite . spec . TargetK8sVersion )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
}
// SuiteName ...
func ( suite * UpgradeSuite ) SuiteName ( ) string {
if suite . spec . ShortName == "" {
suite . spec = suite . specGen ( )
}
2020-03-24 21:20:36 +03:00
return fmt . Sprintf ( "provision.UpgradeSuite.%s-TR%d" , suite . spec . ShortName , suite . track )
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
}
func init ( ) {
allSuites = append ( allSuites ,
2021-03-22 18:56:44 +03:00
& UpgradeSuite { specGen : upgradePreviousToStable , track : 0 } ,
& UpgradeSuite { specGen : upgradeStableToCurrent , track : 1 } ,
& UpgradeSuite { specGen : upgradeCurrentToCurrent , track : 2 } ,
& UpgradeSuite { specGen : upgradeStableToCurrentPreserve , track : 0 } ,
& UpgradeSuite { specGen : upgradeStableToCurrentPreserveStage , track : 1 } ,
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
)
}