Skip to content

Commit 0ac7656

Browse files
committed
Make the apiversion-upgrade management cluster HA
1 parent f5bc974 commit 0ac7656

3 files changed

Lines changed: 1332 additions & 40 deletions

File tree

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ require (
4848
golang.org/x/text v0.37.0
4949
gopkg.in/yaml.v3 v3.0.1
5050
k8s.io/api v0.35.4
51+
k8s.io/apiextensions-apiserver v0.35.4
5152
k8s.io/apimachinery v0.35.4
5253
k8s.io/client-go v0.35.4
5354
k8s.io/cluster-bootstrap v0.35.4
@@ -60,6 +61,7 @@ require (
6061
sigs.k8s.io/cluster-api/test v1.13.2
6162
sigs.k8s.io/controller-runtime v0.23.3
6263
sigs.k8s.io/kind v0.31.0
64+
sigs.k8s.io/yaml v1.6.0
6365
)
6466

6567
require (
@@ -199,7 +201,6 @@ require (
199201
google.golang.org/protobuf v1.36.11 // indirect
200202
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
201203
gopkg.in/inf.v0 v0.9.1 // indirect
202-
k8s.io/apiextensions-apiserver v0.35.4 // indirect
203204
k8s.io/apiserver v0.35.4 // indirect
204205
k8s.io/cli-runtime v0.34.2 // indirect
205206
k8s.io/cloud-provider v0.34.0 // indirect
@@ -213,5 +214,4 @@ require (
213214
sigs.k8s.io/kustomize/kyaml v0.20.1 // indirect
214215
sigs.k8s.io/randfill v1.0.0 // indirect
215216
sigs.k8s.io/structured-merge-diff/v6 v6.4.0 // indirect
216-
sigs.k8s.io/yaml v1.6.0 // indirect
217217
)

test/e2e/capi_test.go

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,13 @@ var _ = Describe("Running the Cluster API E2E tests", func() {
208208
})
209209

210210
Context("upgrade from an old version of v1beta1 to current, and scale workload clusters created in the old version", func() {
211-
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
212-
return capi_e2e.ClusterctlUpgradeSpecInput{
213-
E2EConfig: e2eConfig,
214-
ClusterctlConfigPath: clusterctlConfigPath,
215-
WorkloadFlavor: "machine-and-machine-pool",
216-
BootstrapClusterProxy: bootstrapClusterProxy,
211+
ClusterctlUpgradeSpec(ctx, func() ClusterctlUpgradeSpecInput {
212+
return ClusterctlUpgradeSpecInput{
213+
E2EConfig: e2eConfig,
214+
ClusterctlConfigPath: clusterctlConfigPath,
215+
WorkloadFlavor: "machine-and-machine-pool",
216+
BootstrapClusterProxy: bootstrapClusterProxy,
217+
ManagementClusterControlPlaneMachineCount: ptr.To[int64](3),
217218
ArtifactFolder: artifactFolder,
218219
SkipCleanup: skipCleanup,
219220
PreInit: getPreInitFunc(ctx),
@@ -233,12 +234,13 @@ var _ = Describe("Running the Cluster API E2E tests", func() {
233234
})
234235

235236
Context("upgrade from the latest version of v1beta1 to current, and scale workload clusters created in the old version", func() {
236-
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
237-
return capi_e2e.ClusterctlUpgradeSpecInput{
238-
E2EConfig: e2eConfig,
239-
ClusterctlConfigPath: clusterctlConfigPath,
240-
WorkloadFlavor: "machine-and-machine-pool",
241-
BootstrapClusterProxy: bootstrapClusterProxy,
237+
ClusterctlUpgradeSpec(ctx, func() ClusterctlUpgradeSpecInput {
238+
return ClusterctlUpgradeSpecInput{
239+
E2EConfig: e2eConfig,
240+
ClusterctlConfigPath: clusterctlConfigPath,
241+
WorkloadFlavor: "machine-and-machine-pool",
242+
BootstrapClusterProxy: bootstrapClusterProxy,
243+
ManagementClusterControlPlaneMachineCount: ptr.To[int64](3),
242244
ArtifactFolder: artifactFolder,
243245
SkipCleanup: skipCleanup,
244246
PreInit: getPreInitFunc(ctx),
@@ -258,26 +260,27 @@ var _ = Describe("Running the Cluster API E2E tests", func() {
258260
})
259261

260262
Context("upgrade from an old version of v1beta1 to current, and scale AKS workload clusters created in the old version", func() {
261-
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
262-
return capi_e2e.ClusterctlUpgradeSpecInput{
263-
E2EConfig: e2eConfig,
264-
ClusterctlConfigPath: clusterctlConfigPath,
265-
WorkloadFlavor: "aks",
266-
WorkloadKubernetesVersion: aksKubernetesVersion,
267-
ControlPlaneMachineCount: ptr.To[int64](0),
268-
BootstrapClusterProxy: bootstrapClusterProxy,
269-
ArtifactFolder: artifactFolder,
270-
SkipCleanup: skipCleanup,
271-
PreInit: getPreInitFunc(ctx),
272-
InitWithProvidersContract: "v1beta1",
263+
ClusterctlUpgradeSpec(ctx, func() ClusterctlUpgradeSpecInput {
264+
return ClusterctlUpgradeSpecInput{
265+
E2EConfig: e2eConfig,
266+
ClusterctlConfigPath: clusterctlConfigPath,
267+
WorkloadFlavor: "aks",
268+
WorkloadKubernetesVersion: aksKubernetesVersion,
269+
ControlPlaneMachineCount: ptr.To[int64](0),
270+
BootstrapClusterProxy: bootstrapClusterProxy,
271+
ManagementClusterControlPlaneMachineCount: ptr.To[int64](3),
272+
ArtifactFolder: artifactFolder,
273+
SkipCleanup: skipCleanup,
274+
PreInit: getPreInitFunc(ctx),
275+
InitWithProvidersContract: "v1beta1",
273276
ControlPlaneWaiters: clusterctl.ControlPlaneWaiters{
274277
WaitForControlPlaneInitialized: EnsureControlPlaneInitialized,
275278
},
276279
InitWithKubernetesVersion: e2eConfig.MustGetVariable(KubernetesVersionAPIUpgradeFrom),
277280
InitWithBinary: fmt.Sprintf("https://github.com/kubernetes-sigs/cluster-api/releases/download/%s/clusterctl-{OS}-{ARCH}", e2eConfig.MustGetVariable(OldCAPIUpgradeVersion)),
278281
InitWithCoreProvider: "cluster-api:" + e2eConfig.MustGetVariable(OldCAPIUpgradeVersion),
279282
InitWithInfrastructureProviders: []string{"azure:" + e2eConfig.MustGetVariable(OldProviderUpgradeVersion)},
280-
Upgrades: []capi_e2e.ClusterctlUpgradeSpecInputUpgrade{
283+
Upgrades: []ClusterctlUpgradeSpecInputUpgrade{
281284
{
282285
Contract: clusterv1.GroupVersion.Version,
283286
PostUpgrade: func(managementClusterProxy framework.ClusterProxy, clusterNamespace, clusterName string) {
@@ -296,26 +299,27 @@ var _ = Describe("Running the Cluster API E2E tests", func() {
296299
})
297300

298301
Context("upgrade from the latest version of v1beta1 to current, and scale AKS workload clusters created in the old version", func() {
299-
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
300-
return capi_e2e.ClusterctlUpgradeSpecInput{
301-
E2EConfig: e2eConfig,
302-
ClusterctlConfigPath: clusterctlConfigPath,
303-
WorkloadFlavor: "aks",
304-
WorkloadKubernetesVersion: aksKubernetesVersion,
305-
ControlPlaneMachineCount: ptr.To[int64](0),
306-
BootstrapClusterProxy: bootstrapClusterProxy,
307-
ArtifactFolder: artifactFolder,
308-
SkipCleanup: skipCleanup,
309-
PreInit: getPreInitFunc(ctx),
310-
InitWithProvidersContract: "v1beta1",
302+
ClusterctlUpgradeSpec(ctx, func() ClusterctlUpgradeSpecInput {
303+
return ClusterctlUpgradeSpecInput{
304+
E2EConfig: e2eConfig,
305+
ClusterctlConfigPath: clusterctlConfigPath,
306+
WorkloadFlavor: "aks",
307+
WorkloadKubernetesVersion: aksKubernetesVersion,
308+
ControlPlaneMachineCount: ptr.To[int64](0),
309+
BootstrapClusterProxy: bootstrapClusterProxy,
310+
ManagementClusterControlPlaneMachineCount: ptr.To[int64](3),
311+
ArtifactFolder: artifactFolder,
312+
SkipCleanup: skipCleanup,
313+
PreInit: getPreInitFunc(ctx),
314+
InitWithProvidersContract: "v1beta1",
311315
ControlPlaneWaiters: clusterctl.ControlPlaneWaiters{
312316
WaitForControlPlaneInitialized: EnsureControlPlaneInitialized,
313317
},
314318
InitWithKubernetesVersion: e2eConfig.MustGetVariable(KubernetesVersionAPIUpgradeFrom),
315319
InitWithBinary: fmt.Sprintf("https://github.com/kubernetes-sigs/cluster-api/releases/download/%s/clusterctl-{OS}-{ARCH}", e2eConfig.MustGetVariable(LatestCAPIUpgradeVersion)),
316320
InitWithCoreProvider: "cluster-api:" + e2eConfig.MustGetVariable(LatestCAPIUpgradeVersion),
317321
InitWithInfrastructureProviders: []string{"azure:" + e2eConfig.MustGetVariable(LatestProviderUpgradeVersion)},
318-
Upgrades: []capi_e2e.ClusterctlUpgradeSpecInputUpgrade{
322+
Upgrades: []ClusterctlUpgradeSpecInputUpgrade{
319323
{
320324
Contract: clusterv1.GroupVersion.Version,
321325
PostUpgrade: func(managementClusterProxy framework.ClusterProxy, clusterNamespace, clusterName string) {

0 commit comments

Comments
 (0)