Skip to content

Commit e392c6e

Browse files
committed
add e2e test for cluster class
1 parent d612b8d commit e392c6e

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

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)