@@ -594,4 +594,54 @@ var _ = Describe("Workload cluster creation", func() {
594
594
})
595
595
})
596
596
})
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
+ })
597
647
})
0 commit comments