Skip to content

Commit

Permalink
test: update upgrade tests to 0.10 release
Browse files Browse the repository at this point in the history
In preparation for going 0.10 beta, start testing upgrades to 0.10, drop
0.8 and self-hosted control plane handling in the tests.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
  • Loading branch information
smira authored and talos-bot committed Apr 9, 2021
1 parent 1fcf38f commit daf2208
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -26,7 +26,7 @@ CLUSTERCTL_URL ?= https://github.com/kubernetes-sigs/cluster-api/releases/downlo
SONOBUOY_VERSION ?= 0.50.0
SONOBUOY_URL ?= https://github.com/vmware-tanzu/sonobuoy/releases/download/v$(SONOBUOY_VERSION)/sonobuoy_$(SONOBUOY_VERSION)_$(OPERATING_SYSTEM)_amd64.tar.gz
TESTPKGS ?= github.com/talos-systems/talos/...
RELEASES ?= v0.8.5 v0.9.1
RELEASES ?= v0.9.1 v0.10.0-alpha.2
SHORT_INTEGRATION_TEST ?=
CUSTOM_CNI_URL ?=

Expand Down
44 changes: 6 additions & 38 deletions internal/integration/provision/upgrade.go
Expand Up @@ -54,12 +54,10 @@ type upgradeSpec struct {
SourceInstallerImage string
SourceVersion string
SourceK8sVersion string
SourceSelfHosted bool

TargetInstallerImage string
TargetVersion string
TargetK8sVersion string
TargetSelfHosted bool

MasterNodes int
WorkerNodes int
Expand All @@ -70,13 +68,13 @@ type upgradeSpec struct {
}

const (
previousRelease = "v0.8.5"
stableRelease = "v0.9.1" // or soon-to-be-stable
previousRelease = "v0.9.1"
stableRelease = "v0.10.0-alpha.2" // or soon-to-be-stable
// The current version (the one being built on CI) is DefaultSettings.CurrentVersion.

previousK8sVersion = "1.20.1" // constants.DefaultKubernetesVersion in the previousRelease
stableK8sVersion = "1.20.5" // constants.DefaultKubernetesVersion in the stableRelease
currentK8sVersion = "1.21.0" // next k8s version being tested
previousK8sVersion = "1.20.2" // constants.DefaultKubernetesVersion in the previousRelease
stableK8sVersion = "1.21.0-rc.0" // constants.DefaultKubernetesVersion in the stableRelease
currentK8sVersion = "1.21.0" // next k8s version being tested
)

var defaultNameservers = []net.IP{net.ParseIP("8.8.8.8"), net.ParseIP("1.1.1.1")}
Expand All @@ -91,12 +89,10 @@ func upgradePreviousToStable() upgradeSpec {
SourceInstallerImage: fmt.Sprintf("%s:%s", "ghcr.io/talos-systems/installer", previousRelease),
SourceVersion: previousRelease,
SourceK8sVersion: previousK8sVersion,
SourceSelfHosted: true,

TargetInstallerImage: fmt.Sprintf("%s:%s", "ghcr.io/talos-systems/installer", stableRelease),
TargetVersion: stableRelease,
TargetK8sVersion: stableK8sVersion,
TargetSelfHosted: false,

MasterNodes: DefaultSettings.MasterNodes,
WorkerNodes: DefaultSettings.WorkerNodes,
Expand Down Expand Up @@ -564,27 +560,6 @@ func (suite *UpgradeSuite) upgradeNode(client *talosclient.Client, node provisio
suite.waitForClusterHealth()
}

func (suite *UpgradeSuite) convertSelfHosted(fromSelfHosted, toSelfHosted bool) {
if fromSelfHosted == toSelfHosted {
suite.T().Logf("skipping control plane conversion, as self hosted is %v -> %v", fromSelfHosted, toSelfHosted)

return
}

if toSelfHosted {
suite.Require().FailNow("conversion to self-hosted is not supported")
}

suite.T().Logf("converting Kubernetes to static pods")

options := kubernetes.ConvertOptions{
ControlPlaneEndpoint: suite.controlPlaneEndpoint,
ForceYes: true,
}

suite.Require().NoError(kubernetes.ConvertToStaticPods(suite.ctx, suite.clusterAccess, options))
}

func (suite *UpgradeSuite) upgradeKubernetes(fromVersion, toVersion string) {
if fromVersion == toVersion {
suite.T().Logf("skipping Kubernetes upgrade, as versions are equal %q -> %q", fromVersion, toVersion)
Expand All @@ -601,11 +576,7 @@ func (suite *UpgradeSuite) upgradeKubernetes(fromVersion, toVersion string) {
ControlPlaneEndpoint: suite.controlPlaneEndpoint,
}

if suite.spec.TargetSelfHosted {
suite.Require().NoError(kubernetes.UpgradeSelfHosted(suite.ctx, suite.clusterAccess, options))
} else {
suite.Require().NoError(kubernetes.UpgradeTalosManaged(suite.ctx, suite.clusterAccess, options))
}
suite.Require().NoError(kubernetes.UpgradeTalosManaged(suite.ctx, suite.clusterAccess, options))
}

func (suite *UpgradeSuite) untaint(name string) {
Expand Down Expand Up @@ -666,9 +637,6 @@ func (suite *UpgradeSuite) TestRolling() {
// verify final cluster version
suite.assertSameVersionCluster(client, suite.spec.TargetVersion)

// convert to static pods if required
suite.convertSelfHosted(suite.spec.SourceSelfHosted, suite.spec.TargetSelfHosted)

// upgrade Kubernetes if required
suite.upgradeKubernetes(suite.spec.SourceK8sVersion, suite.spec.TargetK8sVersion)

Expand Down

0 comments on commit daf2208

Please sign in to comment.