Skip to content

Commit c20ed8d

Browse files
committed
Update e2e config and clusterctl-upgrade
This updates mostly the clusterctl-upgrade e2e test. We make use of new functionality in the CAPI framework to calculate the latest patch releases instead of hard-coding them. The upgrade start from CAPI v1.9 instead of v1.6, to keep the tested versions within supported releases. Similarly CAPO upgrades from v0.11. Also an upgrade from v0.12 to main is added. Signed-off-by: Lennart Jern <lennart.jern@est.tech>
1 parent 606fcbd commit c20ed8d

File tree

5 files changed

+83
-49
lines changed

5 files changed

+83
-49
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ E2E_NO_ARTIFACT_TEMPLATES_DIR=test/e2e/data/infrastructure-openstack-no-artifact
175175
.PHONY: e2e-templates
176176
e2e-templates: ## Generate cluster templates for e2e tests
177177
e2e-templates: $(addprefix $(E2E_NO_ARTIFACT_TEMPLATES_DIR)/, \
178-
cluster-template-without-orc.yaml \
179178
cluster-template-md-remediation.yaml \
180179
cluster-template-kcp-remediation.yaml \
181180
cluster-template-multi-az.yaml \

test/e2e/data/e2e_conf.yaml

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
managementClusterName: capo-e2e
88

99
images:
10-
- name: registry.k8s.io/cluster-api/cluster-api-controller:v1.10.1
11-
loadBehavior: tryLoad
12-
- name: registry.k8s.io/cluster-api/kubeadm-bootstrap-controller:v1.10.1
13-
loadBehavior: tryLoad
14-
- name: registry.k8s.io/cluster-api/kubeadm-control-plane-controller:v1.10.1
15-
loadBehavior: tryLoad
1610
# Use local dev images built source tree;
1711
- name: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:e2e
1812
loadBehavior: mustLoad
@@ -23,8 +17,8 @@ providers:
2317
- name: cluster-api
2418
type: CoreProvider
2519
versions:
26-
- name: v1.10.1
27-
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.10.1/core-components.yaml"
20+
- name: "{go://sigs.k8s.io/cluster-api@v1.10}"
21+
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/cluster-api@v1.10}/core-components.yaml"
2822
type: url
2923
contract: v1beta1
3024
files:
@@ -35,8 +29,8 @@ providers:
3529
- old: "--leader-elect"
3630
new: "--leader-elect=false\n - --sync-period=1m"
3731
# For clusterctl upgrade test
38-
- name: v1.6.0
39-
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.0/core-components.yaml"
32+
- name: "{go://sigs.k8s.io/cluster-api@v1.9}"
33+
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/cluster-api@v1.9}/core-components.yaml"
4034
type: url
4135
contract: v1beta1
4236
files:
@@ -49,8 +43,8 @@ providers:
4943
- name: kubeadm
5044
type: BootstrapProvider
5145
versions:
52-
- name: v1.10.1
53-
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.10.1/bootstrap-components.yaml"
46+
- name: "{go://sigs.k8s.io/cluster-api@v1.10}"
47+
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/cluster-api@v1.10}/bootstrap-components.yaml"
5448
type: url
5549
contract: v1beta1
5650
files:
@@ -61,8 +55,8 @@ providers:
6155
- old: "--leader-elect"
6256
new: "--leader-elect=false\n - --sync-period=1m"
6357
# For clusterctl upgrade test
64-
- name: v1.6.0
65-
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.0/bootstrap-components.yaml"
58+
- name: "{go://sigs.k8s.io/cluster-api@v1.9}"
59+
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/cluster-api@v1.9}/bootstrap-components.yaml"
6660
type: url
6761
contract: v1beta1
6862
files:
@@ -75,8 +69,8 @@ providers:
7569
- name: kubeadm
7670
type: ControlPlaneProvider
7771
versions:
78-
- name: v1.10.1
79-
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.10.1/control-plane-components.yaml"
72+
- name: "{go://sigs.k8s.io/cluster-api@v1.10}"
73+
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/cluster-api@v1.10}/control-plane-components.yaml"
8074
type: url
8175
contract: v1beta1
8276
files:
@@ -87,8 +81,8 @@ providers:
8781
- old: "--leader-elect"
8882
new: "--leader-elect=false\n - --sync-period=1m"
8983
# For clusterctl upgrade test
90-
- name: v1.6.0
91-
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.0/control-plane-components.yaml"
84+
- name: "{go://sigs.k8s.io/cluster-api@v1.9}"
85+
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{go://sigs.k8s.io/cluster-api@v1.9}/control-plane-components.yaml"
9286
type: url
9387
contract: v1beta1
9488
files:
@@ -102,8 +96,23 @@ providers:
10296
type: InfrastructureProvider
10397
versions:
10498
# This is only for clusterctl upgrade tests
105-
- name: v0.10.0
106-
value: "https://github.com/kubernetes-sigs/cluster-api-provider-openstack/releases/download/v0.10.0/infrastructure-components.yaml"
99+
- name: "{go://github.com/kubernetes-sigs/cluster-api-provider-openstack@v0.11}"
100+
value: "https://github.com/kubernetes-sigs/cluster-api-provider-openstack/releases/download/{go://github.com/kubernetes-sigs/cluster-api-provider-openstack@v0.11}/infrastructure-components.yaml"
101+
type: url
102+
contract: v1beta1
103+
files:
104+
- sourcePath: "../data/shared/v1beta1_provider/metadata.yaml"
105+
- sourcePath: "./infrastructure-openstack-no-artifact/cluster-template.yaml"
106+
replacements:
107+
- old: "imagePullPolicy: Always"
108+
new: "imagePullPolicy: IfNotPresent"
109+
- old: "--v=2"
110+
new: "--v=4"
111+
- old: "--leader-elect"
112+
new: "--leader-elect=false\n - --sync-period=1m"
113+
# This is only for clusterctl upgrade tests
114+
- name: "{go://github.com/kubernetes-sigs/cluster-api-provider-openstack@v0.12}"
115+
value: "https://github.com/kubernetes-sigs/cluster-api-provider-openstack/releases/download/{go://github.com/kubernetes-sigs/cluster-api-provider-openstack@v0.12}/infrastructure-components.yaml"
107116
type: url
108117
contract: v1beta1
109118
files:

test/e2e/data/kustomize/without-orc/kustomization.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

test/e2e/shared/defaults.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ const (
5555
FlavorWithoutLB = "without-lb"
5656
FlavorMultiNetwork = "multi-network"
5757
FlavorMultiAZ = "multi-az"
58-
FlavorWithoutORC = "without-orc"
5958
FlavorMDRemediation = "md-remediation"
6059
FlavorKCPRemediation = "kcp-remediation"
6160
FlavorFlatcar = "flatcar"

test/e2e/suites/e2e/clusterctl_upgrade_test.go

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,65 @@ import (
2323
"context"
2424

2525
. "github.com/onsi/ginkgo/v2"
26+
. "github.com/onsi/gomega"
2627
capi_e2e "sigs.k8s.io/cluster-api/test/e2e"
28+
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
2729

2830
"sigs.k8s.io/cluster-api-provider-openstack/test/e2e/shared"
2931
)
3032

31-
const OldCAPIVersion = "v1.6.0"
33+
var (
34+
capoRelease011 string
35+
capoRelease012 string
36+
capiRelease19 string
37+
)
3238

33-
var _ = Describe("When testing clusterctl upgrades (v0.10=>current) [clusterctl-upgrade]", func() {
39+
var _ = Describe("When testing clusterctl upgrades (v0.11=>current) [clusterctl-upgrade]", func() {
3440
BeforeEach(func(ctx context.Context) {
3541
shared.ApplyCoreImagesPlus(ctx, e2eCtx, upgradeImage)
42+
setDownloadE2EImageEnvVar()
43+
// Note: This gives the version without the 'v' prefix, so we need to add it below.
44+
capoRelease011, err = clusterctl.ResolveRelease(ctx, "go://github.com/kubernetes-sigs/cluster-api-provider-openstack@v0.11")
45+
Expect(err).ToNot(HaveOccurred(), "failed to get stable release of CAPO")
46+
capoRelease011 = "v" + capoRelease011
47+
// Note: This gives the version without the 'v' prefix, so we need to add it below.
48+
capiRelease19, err = capi_e2e.GetStableReleaseOfMinor(ctx, "1.9")
49+
Expect(err).ToNot(HaveOccurred(), "failed to get stable release of CAPI")
50+
capiRelease19 = "v" + capiRelease19
51+
})
3652

37-
// The upgrade job can't use image references in its machine templates,
38-
// so we must wait for the images to be available before running the
39-
// test.
40-
coreImages := shared.CoreImages(e2eCtx)
41-
allImages := append(coreImages, upgradeImage)
42-
shared.WaitForGlanceImagesAvailable(ctx, e2eCtx, allImages)
53+
capi_e2e.ClusterctlUpgradeSpec(context.TODO(), func() capi_e2e.ClusterctlUpgradeSpecInput {
54+
return capi_e2e.ClusterctlUpgradeSpecInput{
55+
E2EConfig: e2eCtx.E2EConfig,
56+
ClusterctlConfigPath: e2eCtx.Environment.ClusterctlConfigPath,
57+
BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy,
58+
ArtifactFolder: e2eCtx.Settings.ArtifactFolder,
59+
SkipCleanup: false,
60+
InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/" + capiRelease19 + "/clusterctl-{OS}-{ARCH}",
61+
InitWithProvidersContract: "v1beta1",
62+
InitWithInfrastructureProviders: []string{"openstack:" + capoRelease011},
63+
InitWithCoreProvider: "cluster-api:" + capiRelease19,
64+
InitWithBootstrapProviders: []string{"kubeadm:" + capiRelease19},
65+
InitWithControlPlaneProviders: []string{"kubeadm:" + capiRelease19},
66+
MgmtFlavor: shared.FlavorDefault,
67+
WorkloadFlavor: shared.FlavorDefault,
68+
InitWithKubernetesVersion: e2eCtx.E2EConfig.MustGetVariable(shared.KubernetesVersion),
69+
}
70+
})
71+
})
4372

73+
var _ = Describe("When testing clusterctl upgrades (v0.12=>current) [clusterctl-upgrade]", func() {
74+
BeforeEach(func(ctx context.Context) {
75+
shared.ApplyCoreImagesPlus(ctx, e2eCtx, upgradeImage)
4476
setDownloadE2EImageEnvVar()
77+
// Note: This gives the version without the 'v' prefix, so we need to add it below.
78+
capoRelease012, err = clusterctl.ResolveRelease(ctx, "go://github.com/kubernetes-sigs/cluster-api-provider-openstack@v0.12")
79+
Expect(err).ToNot(HaveOccurred(), "failed to get stable release of CAPO")
80+
capoRelease012 = "v" + capoRelease012
81+
// Note: This gives the version without the 'v' prefix, so we need to add it below.
82+
capiRelease19, err = capi_e2e.GetStableReleaseOfMinor(ctx, "1.9")
83+
Expect(err).ToNot(HaveOccurred(), "failed to get stable release of CAPI")
84+
capiRelease19 = "v" + capiRelease19
4585
})
4686

4787
capi_e2e.ClusterctlUpgradeSpec(context.TODO(), func() capi_e2e.ClusterctlUpgradeSpecInput {
@@ -51,14 +91,14 @@ var _ = Describe("When testing clusterctl upgrades (v0.10=>current) [clusterctl-
5191
BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy,
5292
ArtifactFolder: e2eCtx.Settings.ArtifactFolder,
5393
SkipCleanup: false,
54-
InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/" + OldCAPIVersion + "/clusterctl-{OS}-{ARCH}",
94+
InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/" + capiRelease19 + "/clusterctl-{OS}-{ARCH}",
5595
InitWithProvidersContract: "v1beta1",
56-
InitWithInfrastructureProviders: []string{"openstack:v0.10.0"},
57-
InitWithCoreProvider: "cluster-api:" + OldCAPIVersion,
58-
InitWithBootstrapProviders: []string{"kubeadm:" + OldCAPIVersion},
59-
InitWithControlPlaneProviders: []string{"kubeadm:" + OldCAPIVersion},
96+
InitWithInfrastructureProviders: []string{"openstack:" + capoRelease012},
97+
InitWithCoreProvider: "cluster-api:" + capiRelease19,
98+
InitWithBootstrapProviders: []string{"kubeadm:" + capiRelease19},
99+
InitWithControlPlaneProviders: []string{"kubeadm:" + capiRelease19},
60100
MgmtFlavor: shared.FlavorDefault,
61-
WorkloadFlavor: shared.FlavorWithoutORC,
101+
WorkloadFlavor: shared.FlavorDefault,
62102
InitWithKubernetesVersion: e2eCtx.E2EConfig.MustGetVariable(shared.KubernetesVersion),
63103
}
64104
})

0 commit comments

Comments
 (0)