@@ -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"},
@@ -6756,7 +6739,7 @@ resource "google_container_cluster" "with_node_config_gcfs_config" {
6756
6739
`, clusterName, enabled, networkName, subnetworkName)
6757
6740
}
6758
6741
6759
- func testAccContainerCluster_withNodeConfigKubeletConfigSettings (clusterName, networkName, subnetworkName string) string {
6742
+ func testAccContainerCluster_withNodeConfigKubeletConfigSettingsBaseline (clusterName, networkName, subnetworkName string) string {
6760
6743
return fmt.Sprintf(`
6761
6744
resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6762
6745
name = "%s"
@@ -6765,10 +6748,7 @@ resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6765
6748
6766
6749
node_config {
6767
6750
kubelet_config {
6768
- cpu_manager_policy = "static"
6769
- cpu_cfs_quota = true
6770
- cpu_cfs_quota_period = "100ms"
6771
- pod_pids_limit = 2048
6751
+ pod_pids_limit = 1024
6772
6752
}
6773
6753
}
6774
6754
deletion_protection = false
@@ -6778,23 +6758,27 @@ resource "google_container_cluster" "with_node_config_kubelet_config_settings" {
6778
6758
`, clusterName, networkName, subnetworkName)
6779
6759
}
6780
6760
6781
- func testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodeConfig (clusterName, networkName, subnetworkName , insecureKubeletReadonlyPortEnabled string) string {
6761
+ func testAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates (clusterName, cpuManagerPolicy, cpuCfsQuotaPeriod , insecureKubeletReadonlyPortEnabled, networkName, subnetworkName string, podPidsLimit int, cpuCfsQuota bool ) string {
6782
6762
return fmt.Sprintf(`
6783
- resource "google_container_cluster" "with_insecure_kubelet_readonly_port_enabled_in_node_config " {
6763
+ resource "google_container_cluster" "with_node_config_kubelet_config_settings " {
6784
6764
name = "%s"
6785
6765
location = "us-central1-f"
6786
6766
initial_node_count = 1
6787
6767
6788
6768
node_config {
6789
6769
kubelet_config {
6770
+ cpu_manager_policy = "%s"
6771
+ cpu_cfs_quota = %v
6772
+ cpu_cfs_quota_period = "%s"
6790
6773
insecure_kubelet_readonly_port_enabled = "%s"
6774
+ pod_pids_limit = %v
6791
6775
}
6792
6776
}
6793
6777
deletion_protection = false
6794
- network = "%s"
6795
- subnetwork = "%s"
6778
+ network = "%s"
6779
+ subnetwork = "%s"
6796
6780
}
6797
- `, clusterName, insecureKubeletReadonlyPortEnabled, networkName, subnetworkName)
6781
+ `, clusterName, cpuManagerPolicy, cpuCfsQuota, cpuCfsQuotaPeriod, insecureKubeletReadonlyPortEnabled, podPidsLimit , networkName, subnetworkName)
6798
6782
}
6799
6783
6800
6784
func testAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodePool(clusterName, nodePoolName, networkName, subnetworkName, insecureKubeletReadonlyPortEnabled string) string {
0 commit comments