Skip to content

Commit 71e1add

Browse files
committed
add e2e test for cluster class
1 parent 5705000 commit 71e1add

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

test/e2e/azure_test.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,4 +597,54 @@ var _ = Describe("Workload cluster creation", func() {
597597
})
598598
})
599599
})
600+
601+
Context("Creating clusters using clusterclass [REQUIRED]", func() {
602+
It("with a single control plane node, one linux worker node, and one windows worker node", func() {
603+
clusterName = getClusterName(clusterNamePrefix, "clusterclass")
604+
605+
// Opt into using windows with prow template
606+
Expect(os.Setenv("WINDOWS_WORKER_MACHINE_COUNT", "1")).To(Succeed())
607+
Expect(os.Setenv("K8S_FEATURE_GATES", "WindowsHostProcessContainers=true")).To(Succeed())
608+
609+
// Get cluster class yaml. This is a hacky way to get cluster class with existing clusterctl api.
610+
topologyYaml := clusterctl.ConfigCluster(ctx, clusterctl.ConfigClusterInput{
611+
LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()),
612+
ClusterctlConfigPath: clusterctlConfigPath,
613+
KubeconfigPath: bootstrapClusterProxy.GetKubeconfigPath(),
614+
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
615+
Flavor: "topology",
616+
Namespace: namespace.Name,
617+
ClusterName: clusterName,
618+
KubernetesVersion: e2eConfig.GetVariable(capi_e2e.KubernetesVersion),
619+
ControlPlaneMachineCount: pointer.Int64Ptr(1),
620+
WorkerMachineCount: pointer.Int64Ptr(1),
621+
})
622+
Expect(topologyYaml).To(Not(BeEmpty()))
623+
624+
// Create the cluster class.
625+
err := bootstrapClusterProxy.Apply(ctx, topologyYaml)
626+
Expect(err).To(BeNil())
627+
628+
// Create a cluster using the cluster class created above
629+
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
630+
ClusterProxy: bootstrapClusterProxy,
631+
ConfigCluster: clusterctl.ConfigClusterInput{
632+
LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()),
633+
ClusterctlConfigPath: clusterctlConfigPath,
634+
KubeconfigPath: bootstrapClusterProxy.GetKubeconfigPath(),
635+
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
636+
Flavor: "clusterclass",
637+
Namespace: namespace.Name,
638+
ClusterName: clusterName,
639+
KubernetesVersion: e2eConfig.GetVariable(capi_e2e.KubernetesVersion),
640+
ControlPlaneMachineCount: pointer.Int64Ptr(1),
641+
WorkerMachineCount: pointer.Int64Ptr(1),
642+
},
643+
WaitForClusterIntervals: e2eConfig.GetIntervals(specName, "wait-cluster"),
644+
WaitForControlPlaneIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane"),
645+
WaitForMachinePools: e2eConfig.GetIntervals(specName, "wait-machine-pool-nodes"),
646+
}, result)
647+
648+
})
649+
})
600650
})

test/e2e/config/azure-dev.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ providers:
177177
targetName: "cluster-template-custom-vnet.yaml"
178178
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-dual-stack.yaml"
179179
targetName: "cluster-template-dual-stack.yaml"
180+
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-topology.yaml"
181+
targetName: "cluster-template-topology.yaml"
182+
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-clusterclass.yaml"
183+
targetName: "cluster-template-clusterclass.yaml"
180184
replacements:
181185
- old: "--v=0"
182186
new: "--v=2"

0 commit comments

Comments
 (0)