Skip to content

Commit 438ad7b

Browse files
authored
Merge pull request #10984 from chrischdi/test-clusterctl-upgrade-on-latest-mgmt
🌱 test: add coverage to find issues running on the next kubernetes release as management cluster
2 parents b1f6154 + e6f37ea commit 438ad7b

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

scripts/ci-e2e-lib.sh

+10
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ k8s::prepareKindestImagesVariables() {
6363
fi
6464
fi
6565

66+
# Tests not focusing on anything and skipping [Conformance] run a clusterctl upgrade test
67+
# on the latest kubernetes version as management cluster.
68+
if [[ ${GINKGO_FOCUS:-} == "" ]] && [[ ${GINKGO_SKIP} == *"Conformance"* ]]; then
69+
# Note: We do this because we want to specify KUBERNETES_VERSION_LATEST_CI *only* in the e2e config.
70+
if [[ -z "${KUBERNETES_VERSION_LATEST_CI:-}" ]]; then
71+
KUBERNETES_VERSION_LATEST_CI=$(grep KUBERNETES_VERSION_LATEST_CI: < "$E2E_CONF_FILE" | awk -F'"' '{ print $2}')
72+
echo "Defaulting KUBERNETES_VERSION_LATEST_CI to ${KUBERNETES_VERSION_LATEST_CI} to trigger image build (because env var is not set)"
73+
fi
74+
fi
75+
6676
# Tests not focusing on [PR-Blocking], [K8s-Install] or [K8s-Install-ci-latest],
6777
# also run upgrade tests so default KUBERNETES_VERSION_UPGRADE_TO and KUBERNETES_VERSION_UPGRADE_FROM
6878
# to the value in the e2e config if they are not set.

test/e2e/clusterctl_upgrade_test.go

+29
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"k8s.io/utils/ptr"
2929

3030
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
31+
"sigs.k8s.io/cluster-api/test/framework/kubernetesversions"
3132
)
3233

3334
var (
@@ -325,3 +326,31 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.7=>cur
325326
}
326327
})
327328
})
329+
330+
var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.7=>current) on K8S latest ci mgmt cluster [ClusterClass]", func() {
331+
// Get v1.7 latest stable release
332+
version := "1.7"
333+
stableRelease, err := GetStableReleaseOfMinor(ctx, version)
334+
Expect(err).ToNot(HaveOccurred(), "Failed to get stable version for minor release : %s", version)
335+
ClusterctlUpgradeSpec(ctx, func() ClusterctlUpgradeSpecInput {
336+
initKubernetesVersion, err := kubernetesversions.ResolveVersion(ctx, e2eConfig.GetVariable("KUBERNETES_VERSION_LATEST_CI"))
337+
Expect(err).ToNot(HaveOccurred())
338+
return ClusterctlUpgradeSpecInput{
339+
E2EConfig: e2eConfig,
340+
ClusterctlConfigPath: clusterctlConfigPath,
341+
BootstrapClusterProxy: bootstrapClusterProxy,
342+
ArtifactFolder: artifactFolder,
343+
SkipCleanup: skipCleanup,
344+
InfrastructureProvider: ptr.To("docker"),
345+
InitWithBinary: fmt.Sprintf(clusterctlDownloadURL, stableRelease),
346+
InitWithProvidersContract: "v1beta1",
347+
// Note: InitWithKubernetesVersion should be the latest of the next supported kubernetes version by the target Cluster API version.
348+
// Note: WorkloadKubernetesVersion should be the highest mgmt cluster version supported by the source Cluster API version.
349+
InitWithKubernetesVersion: initKubernetesVersion,
350+
WorkloadKubernetesVersion: "v1.30.0",
351+
MgmtFlavor: "topology",
352+
WorkloadFlavor: "topology",
353+
UseKindForManagementCluster: true,
354+
}
355+
})
356+
})

0 commit comments

Comments
 (0)