@@ -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,55 +1548,51 @@ 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(),
1560
1555
},
1561
1556
},
1557
+ Check: resource.ComposeTestCheckFunc(
1558
+ resource.TestCheckNoResourceAttr("google_container_cluster.with_node_config_kubelet_config_settings",
1559
+ "node_config.0.kubelet_config.0.cpu_cfs_quota"),
1560
+ resource.TestCheckNoResourceAttr("google_container_cluster.with_node_config_kubelet_config_settings",
1561
+ "node_config.0.kubelet_config.0.cpu_manager_policy"),
1562
+ resource.TestCheckNoResourceAttr("google_container_cluster.with_node_config_kubelet_config_settings",
1563
+ "node_config.0.kubelet_config.0.insecure_kubelet_readonly_port_enabled"),
1564
+ ),
1562
1565
},
1563
1566
{
1564
1567
ResourceName: "google_container_cluster.with_node_config_kubelet_config_settings",
1565
1568
ImportState: true,
1566
1569
ImportStateVerify: true,
1567
1570
ImportStateVerifyIgnore: []string{"deletion_protection"},
1568
1571
},
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
1572
{
1587
- Config: testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig (clusterName, networkName, subnetworkName , "TRUE"),
1573
+ Config: testAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates (clusterName, "none", "100ms" , "TRUE", networkName, subnetworkName, 2048, true ),
1588
1574
ConfigPlanChecks: resource.ConfigPlanChecks{
1589
1575
PreApply: []plancheck.PlanCheck{
1590
1576
acctest.ExpectNoDelete(),
1591
1577
},
1592
1578
},
1593
1579
},
1594
1580
{
1595
- ResourceName: "google_container_cluster.with_insecure_kubelet_readonly_port_enabled_in_node_config ",
1581
+ ResourceName: "google_container_cluster.with_node_config_kubelet_config_settings ",
1596
1582
ImportState: true,
1597
1583
ImportStateVerify: true,
1598
1584
ImportStateVerifyIgnore: []string{"deletion_protection"},
1599
1585
},
1600
1586
{
1601
- Config: testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig(clusterName, networkName, subnetworkName, "FALSE"),
1587
+ Config: testAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates(clusterName, "static", "", "FALSE", networkName, subnetworkName, 1024, true),
1588
+ ConfigPlanChecks: resource.ConfigPlanChecks{
1589
+ PreApply: []plancheck.PlanCheck{
1590
+ acctest.ExpectNoDelete(),
1591
+ },
1592
+ },
1602
1593
},
1603
1594
{
1604
- ResourceName: "google_container_cluster.with_insecure_kubelet_readonly_port_enabled_in_node_config ",
1595
+ ResourceName: "google_container_cluster.with_node_config_kubelet_config_settings ",
1605
1596
ImportState: true,
1606
1597
ImportStateVerify: true,
1607
1598
ImportStateVerifyIgnore: []string{"deletion_protection"},
@@ -6693,7 +6684,7 @@ resource "google_container_cluster" "with_node_config" {
6693
6684
`, clusterName, networkName, subnetworkName)
6694
6685
}
6695
6686
6696
- func testAccContainerCluster_withNodeConfigKubeletConfigSettings (clusterName, networkName, subnetworkName string) string {
6687
+ func testAccContainerCluster_withNodeConfigKubeletConfigSettingsBaseline (clusterName, networkName, subnetworkName string) string {
6697
6688
return fmt.Sprintf(`
6698
6689
resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6699
6690
name = "%s"
@@ -6702,10 +6693,7 @@ resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6702
6693
6703
6694
node_config {
6704
6695
kubelet_config {
6705
- cpu_manager_policy = "static"
6706
- cpu_cfs_quota = true
6707
- cpu_cfs_quota_period = "100ms"
6708
- pod_pids_limit = 2048
6696
+ pod_pids_limit = 1024
6709
6697
}
6710
6698
}
6711
6699
deletion_protection = false
@@ -6715,23 +6703,27 @@ resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6715
6703
`, clusterName, networkName, subnetworkName)
6716
6704
}
6717
6705
6718
- func testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig (clusterName, networkName, subnetworkName , insecureKubeletReadonlyPortEnabled string) string {
6706
+ func testAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates (clusterName, cpuManagerPolicy, cpuCfsQuotaPeriod , insecureKubeletReadonlyPortEnabled, networkName, subnetworkName string, podPidsLimit int, cpuCfsQuota bool ) string {
6719
6707
return fmt.Sprintf(`
6720
- resource "google_container_cluster" "with_insecure_kubelet_readonly_port_enabled_in_node_config " {
6708
+ resource "google_container_cluster" "with_node_config_kubelet_config_settings " {
6721
6709
name = "%s"
6722
6710
location = "us-central1-f"
6723
6711
initial_node_count = 1
6724
6712
6725
6713
node_config {
6726
6714
kubelet_config {
6715
+ cpu_manager_policy = "%s"
6716
+ cpu_cfs_quota = %v
6717
+ cpu_cfs_quota_period = "%s"
6727
6718
insecure_kubelet_readonly_port_enabled = "%s"
6719
+ pod_pids_limit = %v
6728
6720
}
6729
6721
}
6730
6722
deletion_protection = false
6731
- network = "%s"
6732
- subnetwork = "%s"
6723
+ network = "%s"
6724
+ subnetwork = "%s"
6733
6725
}
6734
- `, clusterName, insecureKubeletReadonlyPortEnabled, networkName, subnetworkName)
6726
+ `, clusterName, cpuManagerPolicy, cpuCfsQuota, cpuCfsQuotaPeriod, insecureKubeletReadonlyPortEnabled, podPidsLimit , networkName, subnetworkName)
6735
6727
}
6736
6728
6737
6729
func testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodePool(clusterName, nodePoolName, networkName, subnetworkName, insecureKubeletReadonlyPortEnabled string) string {
0 commit comments