@@ -77,6 +77,13 @@ type integrationTest struct {
7777 startupScript bool
7878 // verify "kops get assets" functionality
7979 testGetAssets bool
80+ // gceAPIServerIGs is a list of APIServer instance group names and their zones for GCE
81+ gceAPIServerIGs []gceAPIServerIG
82+ }
83+
84+ type gceAPIServerIG struct {
85+ name string
86+ zone string
8087}
8188
8289func newIntegrationTest (clusterName , srcDir string ) * integrationTest {
@@ -151,6 +158,11 @@ func (i *integrationTest) withCiliumEtcd() *integrationTest {
151158 return i
152159}
153160
161+ func (i * integrationTest ) withGCEDedicatedAPIServer (name , zone string ) * integrationTest {
162+ i .gceAPIServerIGs = append (i .gceAPIServerIGs , gceAPIServerIG {name : name , zone : zone })
163+ return i
164+ }
165+
154166func (i * integrationTest ) withDedicatedAPIServer () * integrationTest {
155167 i .expectTerraformFilenames = append (i .expectTerraformFilenames ,
156168 "aws_iam_role_apiservers." + i .clusterName + "_policy" ,
@@ -408,6 +420,21 @@ func TestMinimalGCEPublicLoadBalancer(t *testing.T) {
408420 runTestTerraformGCE (t )
409421}
410422
423+ // TestMinimalGCEPublicLoadBalancerAPIServer runs tests on a minimal GCE configuration with a public load balancer and an APIServer instance group.
424+ func TestMinimalGCEPublicLoadBalancerAPIServer (t * testing.T ) {
425+ featureflag .ParseFlags ("+APIServerNodes" )
426+ defer featureflag .ParseFlags ("-APIServerNodes" )
427+
428+ newIntegrationTest ("minimal-gce-plb-apiserver.example.com" , "minimal_gce_plb_apiserver" ).
429+ withAddons (
430+ dnsControllerAddon ,
431+ gcpCCMAddon ,
432+ gcpPDCSIAddon ,
433+ ).
434+ withGCEDedicatedAPIServer ("apiserver-us-test1-a" , "us-test1-a" ).
435+ runTestTerraformGCE (t )
436+ }
437+
411438// TestMinimalGCELongClusterName runs tests on a minimal GCE configuration with a very long cluster name
412439func TestMinimalGCELongClusterName (t * testing.T ) {
413440 newIntegrationTest ("minimal-gce-with-a-very-very-very-very-very-long-name.example.com" , "minimal_gce_longclustername" ).
@@ -1681,6 +1708,17 @@ func (i *integrationTest) runTestTerraformGCE(t *testing.T) {
16811708 }
16821709 }
16831710
1711+ for _ , ig := range i .gceAPIServerIGs {
1712+ expectedFilenames = append (expectedFilenames , "aws_s3_object_nodeupconfig-" + ig .name + "_content" )
1713+
1714+ prefix := "google_compute_instance_template_" + ig .name + "-" + gce .SafeClusterName (i .clusterName ) + "_metadata_"
1715+ if ! i .startupScript {
1716+ expectedFilenames = append (expectedFilenames , prefix + "user-data" )
1717+ } else {
1718+ expectedFilenames = append (expectedFilenames , prefix + "startup-script" )
1719+ }
1720+ }
1721+
16841722 i .runTest (t , ctx , h , expectedFilenames , "" , "" , nil )
16851723}
16861724
0 commit comments