@@ -1579,12 +1579,7 @@ func TestAccContainerCluster_withNodeConfigGcfsConfig(t *testing.T) {
1579
1579
})
1580
1580
}
1581
1581
1582
- // Note: Updates for these are currently known to be broken (b/361634104), and
1583
- // so are not tested here.
1584
- // They can probably be made similar to, or consolidated with,
1585
- // TestAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfigUpdates
1586
- // after that's resolved.
1587
- func TestAccContainerCluster_withNodeConfigKubeletConfigSettings(t *testing.T) {
1582
+ func TestAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates(t *testing.T) {
1588
1583
t.Parallel()
1589
1584
clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))
1590
1585
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
@@ -1596,7 +1591,7 @@ func TestAccContainerCluster_withNodeConfigKubeletConfigSettings(t *testing.T) {
1596
1591
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
1597
1592
Steps: []resource.TestStep{
1598
1593
{
1599
- Config: testAccContainerCluster_withNodeConfigKubeletConfigSettings (clusterName, networkName, subnetworkName),
1594
+ Config: testAccContainerCluster_withNodeConfigKubeletConfigSettingsBaseline (clusterName, networkName, subnetworkName),
1600
1595
ConfigPlanChecks: resource.ConfigPlanChecks{
1601
1596
PreApply: []plancheck.PlanCheck{
1602
1597
acctest.ExpectNoDelete(),
@@ -1609,42 +1604,30 @@ func TestAccContainerCluster_withNodeConfigKubeletConfigSettings(t *testing.T) {
1609
1604
ImportStateVerify: true,
1610
1605
ImportStateVerifyIgnore: []string{"deletion_protection"},
1611
1606
},
1612
- },
1613
- })
1614
- }
1615
-
1616
- // This is for node_config.kubelet_config, which affects the default node-pool
1617
- // (default-pool) when created via the google_container_cluster resource
1618
- func TestAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfigUpdates(t *testing.T) {
1619
- t.Parallel()
1620
- clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))
1621
- networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
1622
- subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
1623
-
1624
- acctest.VcrTest(t, resource.TestCase{
1625
- PreCheck: func() { acctest.AccTestPreCheck(t) },
1626
- ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
1627
- CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
1628
- Steps: []resource.TestStep{
1629
1607
{
1630
- Config: testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig (clusterName, networkName, subnetworkName , "TRUE"),
1608
+ Config: testAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates (clusterName, "none", "100ms" , "TRUE", networkName, subnetworkName, 2048, true ),
1631
1609
ConfigPlanChecks: resource.ConfigPlanChecks{
1632
1610
PreApply: []plancheck.PlanCheck{
1633
1611
acctest.ExpectNoDelete(),
1634
1612
},
1635
1613
},
1636
1614
},
1637
1615
{
1638
- ResourceName: "google_container_cluster.with_insecure_kubelet_readonly_port_enabled_in_node_config ",
1616
+ ResourceName: "google_container_cluster.with_node_config_kubelet_config_settings ",
1639
1617
ImportState: true,
1640
1618
ImportStateVerify: true,
1641
1619
ImportStateVerifyIgnore: []string{"deletion_protection"},
1642
1620
},
1643
1621
{
1644
- Config: testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig(clusterName, networkName, subnetworkName, "FALSE"),
1622
+ Config: testAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates(clusterName, "static", "", "FALSE", networkName, subnetworkName, 1024, true),
1623
+ ConfigPlanChecks: resource.ConfigPlanChecks{
1624
+ PreApply: []plancheck.PlanCheck{
1625
+ acctest.ExpectNoDelete(),
1626
+ },
1627
+ },
1645
1628
},
1646
1629
{
1647
- ResourceName: "google_container_cluster.with_insecure_kubelet_readonly_port_enabled_in_node_config ",
1630
+ ResourceName: "google_container_cluster.with_node_config_kubelet_config_settings ",
1648
1631
ImportState: true,
1649
1632
ImportStateVerify: true,
1650
1633
ImportStateVerifyIgnore: []string{"deletion_protection"},
@@ -6782,7 +6765,7 @@ resource "google_container_cluster" "with_node_config_gcfs_config" {
6782
6765
`, clusterName, enabled, networkName, subnetworkName)
6783
6766
}
6784
6767
6785
- func testAccContainerCluster_withNodeConfigKubeletConfigSettings (clusterName, networkName, subnetworkName string) string {
6768
+ func testAccContainerCluster_withNodeConfigKubeletConfigSettingsBaseline (clusterName, networkName, subnetworkName string) string {
6786
6769
return fmt.Sprintf(`
6787
6770
resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6788
6771
name = "%s"
@@ -6791,10 +6774,7 @@ resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6791
6774
6792
6775
node_config {
6793
6776
kubelet_config {
6794
- cpu_manager_policy = "static"
6795
- cpu_cfs_quota = true
6796
- cpu_cfs_quota_period = "100ms"
6797
- pod_pids_limit = 2048
6777
+ pod_pids_limit = 1024
6798
6778
}
6799
6779
}
6800
6780
deletion_protection = false
@@ -6804,23 +6784,27 @@ resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6804
6784
`, clusterName, networkName, subnetworkName)
6805
6785
}
6806
6786
6807
- func testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig (clusterName, networkName, subnetworkName , insecureKubeletReadonlyPortEnabled string) string {
6787
+ func testAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates (clusterName, cpuManagerPolicy, cpuCfsQuotaPeriod , insecureKubeletReadonlyPortEnabled, networkName, subnetworkName string, podPidsLimit int, cpuCfsQuota bool ) string {
6808
6788
return fmt.Sprintf(`
6809
- resource "google_container_cluster" "with_insecure_kubelet_readonly_port_enabled_in_node_config " {
6789
+ resource "google_container_cluster" "with_node_config_kubelet_config_settings " {
6810
6790
name = "%s"
6811
6791
location = "us-central1-f"
6812
6792
initial_node_count = 1
6813
6793
6814
6794
node_config {
6815
6795
kubelet_config {
6796
+ cpu_manager_policy = "%s"
6797
+ cpu_cfs_quota = %v
6798
+ cpu_cfs_quota_period = "%s"
6816
6799
insecure_kubelet_readonly_port_enabled = "%s"
6800
+ pod_pids_limit = %v
6817
6801
}
6818
6802
}
6819
6803
deletion_protection = false
6820
- network = "%s"
6821
- subnetwork = "%s"
6804
+ network = "%s"
6805
+ subnetwork = "%s"
6822
6806
}
6823
- `, clusterName, insecureKubeletReadonlyPortEnabled, networkName, subnetworkName)
6807
+ `, clusterName, cpuManagerPolicy, cpuCfsQuota, cpuCfsQuotaPeriod, insecureKubeletReadonlyPortEnabled, podPidsLimit , networkName, subnetworkName)
6824
6808
}
6825
6809
6826
6810
func testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodePool(clusterName, nodePoolName, networkName, subnetworkName, insecureKubeletReadonlyPortEnabled string) string {
0 commit comments