@@ -1320,6 +1320,83 @@ func TestAccContainerCluster_withNodeConfig(t *testing.T) {
1320
1320
})
1321
1321
}
1322
1322
1323
+ func TestAccContainerCluster_withNodeConfigGcfsConfig (t * testing.T ) {
1324
+ t .Parallel ()
1325
+ clusterName := fmt .Sprintf ("tf-test-cluster-%s" , acctest .RandString (t , 10 ))
1326
+ networkName := acctest .BootstrapSharedTestNetwork (t , "gke-cluster" )
1327
+ subnetworkName := acctest .BootstrapSubnet (t , "gke-cluster" , networkName )
1328
+
1329
+ acctest .VcrTest (t , resource.TestCase {
1330
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
1331
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
1332
+ CheckDestroy : testAccCheckContainerClusterDestroyProducer (t ),
1333
+ Steps : []resource.TestStep {
1334
+ {
1335
+ Config : testAccContainerCluster_withNodeConfigGcfsConfig (clusterName , networkName , subnetworkName , false ),
1336
+ ConfigPlanChecks : resource.ConfigPlanChecks {
1337
+ PreApply : []plancheck.PlanCheck {
1338
+ acctest .ExpectNoDelete (),
1339
+ },
1340
+ },
1341
+ },
1342
+ {
1343
+ ResourceName : "google_container_cluster.with_node_config_gcfs_config" ,
1344
+ ImportState : true ,
1345
+ ImportStateVerify : true ,
1346
+ ImportStateVerifyIgnore : []string {"deletion_protection" },
1347
+ },
1348
+ {
1349
+ Config : testAccContainerCluster_withNodeConfigGcfsConfig (clusterName , networkName , subnetworkName , true ),
1350
+ ConfigPlanChecks : resource.ConfigPlanChecks {
1351
+ PreApply : []plancheck.PlanCheck {
1352
+ acctest .ExpectNoDelete (),
1353
+ },
1354
+ },
1355
+ },
1356
+ {
1357
+ ResourceName : "google_container_cluster.with_node_config_gcfs_config" ,
1358
+ ImportState : true ,
1359
+ ImportStateVerify : true ,
1360
+ ImportStateVerifyIgnore : []string {"deletion_protection" },
1361
+ },
1362
+ },
1363
+ })
1364
+ }
1365
+
1366
+ // Note: Updates for these are currently known to be broken (b/361634104), and
1367
+ // so are not tested here.
1368
+ // They can probably be made similar to, or consolidated with,
1369
+ // TestAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfigUpdates
1370
+ // after that's resolved.
1371
+ func TestAccContainerCluster_withNodeConfigKubeletConfigSettings (t * testing.T ) {
1372
+ t .Parallel ()
1373
+ clusterName := fmt .Sprintf ("tf-test-cluster-%s" , acctest .RandString (t , 10 ))
1374
+ networkName := acctest .BootstrapSharedTestNetwork (t , "gke-cluster" )
1375
+ subnetworkName := acctest .BootstrapSubnet (t , "gke-cluster" , networkName )
1376
+
1377
+ acctest .VcrTest (t , resource.TestCase {
1378
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
1379
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
1380
+ CheckDestroy : testAccCheckContainerClusterDestroyProducer (t ),
1381
+ Steps : []resource.TestStep {
1382
+ {
1383
+ Config : testAccContainerCluster_withNodeConfigKubeletConfigSettings (clusterName , networkName , subnetworkName ),
1384
+ ConfigPlanChecks : resource.ConfigPlanChecks {
1385
+ PreApply : []plancheck.PlanCheck {
1386
+ acctest .ExpectNoDelete (),
1387
+ },
1388
+ },
1389
+ },
1390
+ {
1391
+ ResourceName : "google_container_cluster.with_node_config_kubelet_config_settings" ,
1392
+ ImportState : true ,
1393
+ ImportStateVerify : true ,
1394
+ ImportStateVerifyIgnore : []string {"deletion_protection" },
1395
+ },
1396
+ },
1397
+ })
1398
+ }
1399
+
1323
1400
// This is for node_config.kubelet_config, which affects the default node-pool
1324
1401
// (default-pool) when created via the google_container_cluster resource
1325
1402
func TestAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfigUpdates (t * testing.T ) {
@@ -5925,6 +6002,48 @@ resource "google_container_cluster" "with_node_config" {
5925
6002
` , clusterName , networkName , subnetworkName )
5926
6003
}
5927
6004
6005
+ func testAccContainerCluster_withNodeConfigGcfsConfig (clusterName , networkName , subnetworkName string , enabled bool ) string {
6006
+ return fmt .Sprintf (`
6007
+ resource "google_container_cluster" "with_node_config_gcfs_config" {
6008
+ name = "%s"
6009
+ location = "us-central1-f"
6010
+ initial_node_count = 1
6011
+
6012
+ node_config {
6013
+ gcfs_config {
6014
+ enabled = %t
6015
+ }
6016
+ }
6017
+
6018
+ deletion_protection = false
6019
+ network = "%s"
6020
+ subnetwork = "%s"
6021
+ }
6022
+ ` , clusterName , enabled , networkName , subnetworkName )
6023
+ }
6024
+
6025
+ func testAccContainerCluster_withNodeConfigKubeletConfigSettings (clusterName , networkName , subnetworkName string ) string {
6026
+ return fmt .Sprintf (`
6027
+ resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6028
+ name = "%s"
6029
+ location = "us-central1-f"
6030
+ initial_node_count = 1
6031
+
6032
+ node_config {
6033
+ kubelet_config {
6034
+ cpu_manager_policy = "static"
6035
+ cpu_cfs_quota = true
6036
+ cpu_cfs_quota_period = "100ms"
6037
+ pod_pids_limit = 2048
6038
+ }
6039
+ }
6040
+ deletion_protection = false
6041
+ network = "%s"
6042
+ subnetwork = "%s"
6043
+ }
6044
+ ` , clusterName , networkName , subnetworkName )
6045
+ }
6046
+
5928
6047
func testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig (clusterName , networkName , subnetworkName , insecureKubeletReadonlyPortEnabled string ) string {
5929
6048
return fmt .Sprintf (`
5930
6049
resource "google_container_cluster" "with_insecure_kubelet_readonly_port_enabled_in_node_config" {
0 commit comments