@@ -1525,6 +1525,83 @@ func TestAccContainerCluster_withNodeConfig(t *testing.T) {
1525
1525
})
1526
1526
}
1527
1527
1528
+ func TestAccContainerCluster_withNodeConfigGcfsConfig (t * testing.T ) {
1529
+ t .Parallel ()
1530
+ clusterName := fmt .Sprintf ("tf-test-cluster-%s" , acctest .RandString (t , 10 ))
1531
+ networkName := acctest .BootstrapSharedTestNetwork (t , "gke-cluster" )
1532
+ subnetworkName := acctest .BootstrapSubnet (t , "gke-cluster" , networkName )
1533
+
1534
+ acctest .VcrTest (t , resource.TestCase {
1535
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
1536
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
1537
+ CheckDestroy : testAccCheckContainerClusterDestroyProducer (t ),
1538
+ Steps : []resource.TestStep {
1539
+ {
1540
+ Config : testAccContainerCluster_withNodeConfigGcfsConfig (clusterName , networkName , subnetworkName , false ),
1541
+ ConfigPlanChecks : resource.ConfigPlanChecks {
1542
+ PreApply : []plancheck.PlanCheck {
1543
+ acctest .ExpectNoDelete (),
1544
+ },
1545
+ },
1546
+ },
1547
+ {
1548
+ ResourceName : "google_container_cluster.with_node_config_gcfs_config" ,
1549
+ ImportState : true ,
1550
+ ImportStateVerify : true ,
1551
+ ImportStateVerifyIgnore : []string {"deletion_protection" },
1552
+ },
1553
+ {
1554
+ Config : testAccContainerCluster_withNodeConfigGcfsConfig (clusterName , networkName , subnetworkName , true ),
1555
+ ConfigPlanChecks : resource.ConfigPlanChecks {
1556
+ PreApply : []plancheck.PlanCheck {
1557
+ acctest .ExpectNoDelete (),
1558
+ },
1559
+ },
1560
+ },
1561
+ {
1562
+ ResourceName : "google_container_cluster.with_node_config_gcfs_config" ,
1563
+ ImportState : true ,
1564
+ ImportStateVerify : true ,
1565
+ ImportStateVerifyIgnore : []string {"deletion_protection" },
1566
+ },
1567
+ },
1568
+ })
1569
+ }
1570
+
1571
+ // Note: Updates for these are currently known to be broken (b/361634104), and
1572
+ // so are not tested here.
1573
+ // They can probably be made similar to, or consolidated with,
1574
+ // TestAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfigUpdates
1575
+ // after that's resolved.
1576
+ func TestAccContainerCluster_withNodeConfigKubeletConfigSettings (t * testing.T ) {
1577
+ t .Parallel ()
1578
+ clusterName := fmt .Sprintf ("tf-test-cluster-%s" , acctest .RandString (t , 10 ))
1579
+ networkName := acctest .BootstrapSharedTestNetwork (t , "gke-cluster" )
1580
+ subnetworkName := acctest .BootstrapSubnet (t , "gke-cluster" , networkName )
1581
+
1582
+ acctest .VcrTest (t , resource.TestCase {
1583
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
1584
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
1585
+ CheckDestroy : testAccCheckContainerClusterDestroyProducer (t ),
1586
+ Steps : []resource.TestStep {
1587
+ {
1588
+ Config : testAccContainerCluster_withNodeConfigKubeletConfigSettings (clusterName , networkName , subnetworkName ),
1589
+ ConfigPlanChecks : resource.ConfigPlanChecks {
1590
+ PreApply : []plancheck.PlanCheck {
1591
+ acctest .ExpectNoDelete (),
1592
+ },
1593
+ },
1594
+ },
1595
+ {
1596
+ ResourceName : "google_container_cluster.with_node_config_kubelet_config_settings" ,
1597
+ ImportState : true ,
1598
+ ImportStateVerify : true ,
1599
+ ImportStateVerifyIgnore : []string {"deletion_protection" },
1600
+ },
1601
+ },
1602
+ })
1603
+ }
1604
+
1528
1605
// This is for node_config.kubelet_config, which affects the default node-pool
1529
1606
// (default-pool) when created via the google_container_cluster resource
1530
1607
func TestAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfigUpdates (t * testing.T ) {
@@ -6664,6 +6741,48 @@ resource "google_container_cluster" "with_node_config" {
6664
6741
` , clusterName , networkName , subnetworkName )
6665
6742
}
6666
6743
6744
+ func testAccContainerCluster_withNodeConfigGcfsConfig (clusterName , networkName , subnetworkName string , enabled bool ) string {
6745
+ return fmt .Sprintf (`
6746
+ resource "google_container_cluster" "with_node_config_gcfs_config" {
6747
+ name = "%s"
6748
+ location = "us-central1-f"
6749
+ initial_node_count = 1
6750
+
6751
+ node_config {
6752
+ gcfs_config {
6753
+ enabled = %t
6754
+ }
6755
+ }
6756
+
6757
+ deletion_protection = false
6758
+ network = "%s"
6759
+ subnetwork = "%s"
6760
+ }
6761
+ ` , clusterName , enabled , networkName , subnetworkName )
6762
+ }
6763
+
6764
+ func testAccContainerCluster_withNodeConfigKubeletConfigSettings (clusterName , networkName , subnetworkName string ) string {
6765
+ return fmt .Sprintf (`
6766
+ resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6767
+ name = "%s"
6768
+ location = "us-central1-f"
6769
+ initial_node_count = 1
6770
+
6771
+ node_config {
6772
+ kubelet_config {
6773
+ cpu_manager_policy = "static"
6774
+ cpu_cfs_quota = true
6775
+ cpu_cfs_quota_period = "100ms"
6776
+ pod_pids_limit = 2048
6777
+ }
6778
+ }
6779
+ deletion_protection = false
6780
+ network = "%s"
6781
+ subnetwork = "%s"
6782
+ }
6783
+ ` , clusterName , networkName , subnetworkName )
6784
+ }
6785
+
6667
6786
func testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig (clusterName , networkName , subnetworkName , insecureKubeletReadonlyPortEnabled string ) string {
6668
6787
return fmt .Sprintf (`
6669
6788
resource "google_container_cluster" "with_insecure_kubelet_readonly_port_enabled_in_node_config" {
0 commit comments