@@ -1536,12 +1536,7 @@ func TestAccContainerCluster_withNodeConfig(t *testing.T) {
1536
1536
})
1537
1537
}
1538
1538
1539
- // Note: Updates for these are currently known to be broken (b/361634104), and
1540
- // so are not tested here.
1541
- // They can probably be made similar to, or consolidated with,
1542
- // TestAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfigUpdates
1543
- // after that's resolved.
1544
- func TestAccContainerCluster_withNodeConfigKubeletConfigSettings(t *testing.T) {
1539
+ func TestAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates(t *testing.T) {
1545
1540
t.Parallel()
1546
1541
clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))
1547
1542
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
@@ -1553,7 +1548,7 @@ func TestAccContainerCluster_withNodeConfigKubeletConfigSettings(t *testing.T) {
1553
1548
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
1554
1549
Steps: []resource.TestStep{
1555
1550
{
1556
- Config: testAccContainerCluster_withNodeConfigKubeletConfigSettings (clusterName, networkName, subnetworkName),
1551
+ Config: testAccContainerCluster_withNodeConfigKubeletConfigSettingsBaseline (clusterName, networkName, subnetworkName),
1557
1552
ConfigPlanChecks: resource.ConfigPlanChecks{
1558
1553
PreApply: []plancheck.PlanCheck{
1559
1554
acctest.ExpectNoDelete(),
@@ -1566,42 +1561,30 @@ func TestAccContainerCluster_withNodeConfigKubeletConfigSettings(t *testing.T) {
1566
1561
ImportStateVerify: true,
1567
1562
ImportStateVerifyIgnore: []string{"deletion_protection"},
1568
1563
},
1569
- },
1570
- })
1571
- }
1572
-
1573
- // This is for node_config.kubelet_config, which affects the default node-pool
1574
- // (default-pool) when created via the google_container_cluster resource
1575
- func TestAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfigUpdates(t *testing.T) {
1576
- t.Parallel()
1577
- clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))
1578
- networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
1579
- subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
1580
-
1581
- acctest.VcrTest(t, resource.TestCase{
1582
- PreCheck: func() { acctest.AccTestPreCheck(t) },
1583
- ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
1584
- CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
1585
- Steps: []resource.TestStep{
1586
1564
{
1587
- Config: testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig (clusterName, networkName, subnetworkName , "TRUE"),
1565
+ Config: testAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates (clusterName, "none", "100ms" , "TRUE", networkName, subnetworkName, 2048, true ),
1588
1566
ConfigPlanChecks: resource.ConfigPlanChecks{
1589
1567
PreApply: []plancheck.PlanCheck{
1590
1568
acctest.ExpectNoDelete(),
1591
1569
},
1592
1570
},
1593
1571
},
1594
1572
{
1595
- ResourceName: "google_container_cluster.with_insecure_kubelet_readonly_port_enabled_in_node_config ",
1573
+ ResourceName: "google_container_cluster.with_node_config_kubelet_config_settings ",
1596
1574
ImportState: true,
1597
1575
ImportStateVerify: true,
1598
1576
ImportStateVerifyIgnore: []string{"deletion_protection"},
1599
1577
},
1600
1578
{
1601
- Config: testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig(clusterName, networkName, subnetworkName, "FALSE"),
1579
+ Config: testAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates(clusterName, "static", "", "FALSE", networkName, subnetworkName, 1024, true),
1580
+ ConfigPlanChecks: resource.ConfigPlanChecks{
1581
+ PreApply: []plancheck.PlanCheck{
1582
+ acctest.ExpectNoDelete(),
1583
+ },
1584
+ },
1602
1585
},
1603
1586
{
1604
- ResourceName: "google_container_cluster.with_insecure_kubelet_readonly_port_enabled_in_node_config ",
1587
+ ResourceName: "google_container_cluster.with_node_config_kubelet_config_settings ",
1605
1588
ImportState: true,
1606
1589
ImportStateVerify: true,
1607
1590
ImportStateVerifyIgnore: []string{"deletion_protection"},
@@ -6693,7 +6676,7 @@ resource "google_container_cluster" "with_node_config" {
6693
6676
`, clusterName, networkName, subnetworkName)
6694
6677
}
6695
6678
6696
- func testAccContainerCluster_withNodeConfigKubeletConfigSettings (clusterName, networkName, subnetworkName string) string {
6679
+ func testAccContainerCluster_withNodeConfigKubeletConfigSettingsBaseline (clusterName, networkName, subnetworkName string) string {
6697
6680
return fmt.Sprintf(`
6698
6681
resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6699
6682
name = "%s"
@@ -6702,10 +6685,7 @@ resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6702
6685
6703
6686
node_config {
6704
6687
kubelet_config {
6705
- cpu_manager_policy = "static"
6706
- cpu_cfs_quota = true
6707
- cpu_cfs_quota_period = "100ms"
6708
- pod_pids_limit = 2048
6688
+ pod_pids_limit = 1024
6709
6689
}
6710
6690
}
6711
6691
deletion_protection = false
@@ -6715,23 +6695,27 @@ resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6715
6695
`, clusterName, networkName, subnetworkName)
6716
6696
}
6717
6697
6718
- func testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig (clusterName, networkName, subnetworkName , insecureKubeletReadonlyPortEnabled string) string {
6698
+ func testAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates (clusterName, cpuManagerPolicy, cpuCfsQuotaPeriod , insecureKubeletReadonlyPortEnabled, networkName, subnetworkName string, podPidsLimit int, cpuCfsQuota bool ) string {
6719
6699
return fmt.Sprintf(`
6720
- resource "google_container_cluster" "with_insecure_kubelet_readonly_port_enabled_in_node_config " {
6700
+ resource "google_container_cluster" "with_node_config_kubelet_config_settings " {
6721
6701
name = "%s"
6722
6702
location = "us-central1-f"
6723
6703
initial_node_count = 1
6724
6704
6725
6705
node_config {
6726
6706
kubelet_config {
6707
+ cpu_manager_policy = "%s"
6708
+ cpu_cfs_quota = %v
6709
+ cpu_cfs_quota_period = "%s"
6727
6710
insecure_kubelet_readonly_port_enabled = "%s"
6711
+ pod_pids_limit = %v
6728
6712
}
6729
6713
}
6730
6714
deletion_protection = false
6731
- network = "%s"
6732
- subnetwork = "%s"
6715
+ network = "%s"
6716
+ subnetwork = "%s"
6733
6717
}
6734
- `, clusterName, insecureKubeletReadonlyPortEnabled, networkName, subnetworkName)
6718
+ `, clusterName, cpuManagerPolicy, cpuCfsQuota, cpuCfsQuotaPeriod, insecureKubeletReadonlyPortEnabled, podPidsLimit , networkName, subnetworkName)
6735
6719
}
6736
6720
6737
6721
func testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodePool(clusterName, nodePoolName, networkName, subnetworkName, insecureKubeletReadonlyPortEnabled string) string {
0 commit comments