@@ -597,4 +597,54 @@ var _ = Describe("Workload cluster creation", func() {
597
597
})
598
598
})
599
599
})
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
+ })
600
650
})
0 commit comments