@@ -2068,6 +2068,68 @@ func TestAccContainerCluster_withNodeConfigLinuxNodeConfig(t *testing.T) {
20682068 })
20692069}
20702070
2071+ func TestAccContainerCluster_withKubeletConfig (t * testing.T ) {
2072+ t .Parallel ()
2073+
2074+ clusterName := fmt .Sprintf ("tf-test-cluster-%s" , acctest .RandString (t , 10 ))
2075+ networkName := acctest .BootstrapSharedTestNetwork (t , "gke-cluster" )
2076+ subnetworkName := acctest .BootstrapSubnet (t , "gke-cluster" , networkName )
2077+
2078+ acctest .VcrTest (t , resource.TestCase {
2079+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
2080+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
2081+ CheckDestroy : testAccCheckContainerClusterDestroyProducer (t ),
2082+ Steps : []resource.TestStep {
2083+ {
2084+ Config : testAccContainerCluster_withKubeletConfig (clusterName , networkName , subnetworkName , "none" , "None" , "best-effort" , "pod" ),
2085+ Check : resource .ComposeTestCheckFunc (
2086+ resource .TestCheckResourceAttr (
2087+ "google_container_cluster.with_kubelet_config" ,
2088+ "node_config.0.kubelet_config.0.cpu_manager_policy" , "none" ),
2089+ resource .TestCheckResourceAttr (
2090+ "google_container_cluster.with_kubelet_config" ,
2091+ "node_config.0.kubelet_config.0.memory_manager.0.policy" , "None" ),
2092+ resource .TestCheckResourceAttr (
2093+ "google_container_cluster.with_kubelet_config" ,
2094+ "node_config.0.kubelet_config.0.topology_manager.0.policy" , "best-effort" ),
2095+ resource .TestCheckResourceAttr (
2096+ "google_container_cluster.with_kubelet_config" ,
2097+ "node_config.0.kubelet_config.0.topology_manager.0.scope" , "pod" ),
2098+ ),
2099+ },
2100+ {
2101+ ResourceName : "google_container_cluster.with_kubelet_config" ,
2102+ ImportState : true ,
2103+ ImportStateVerify : true ,
2104+ ImportStateVerifyIgnore : []string {"deletion_protection" },
2105+ },
2106+ {
2107+ Config : testAccContainerCluster_withKubeletConfig (clusterName , networkName , subnetworkName , "static" , "Static" , "single-numa-node" , "pod" ),
2108+ Check : resource .ComposeTestCheckFunc (
2109+ resource .TestCheckResourceAttr (
2110+ "google_container_cluster.with_kubelet_config" ,
2111+ "node_config.0.kubelet_config.0.cpu_manager_policy" , "static" ),
2112+ resource .TestCheckResourceAttr (
2113+ "google_container_cluster.with_kubelet_config" ,
2114+ "node_config.0.kubelet_config.0.memory_manager.0.policy" , "Static" ),
2115+ resource .TestCheckResourceAttr (
2116+ "google_container_cluster.with_kubelet_config" ,
2117+ "node_config.0.kubelet_config.0.topology_manager.0.policy" , "single-numa-node" ),
2118+ resource .TestCheckResourceAttr (
2119+ "google_container_cluster.with_kubelet_config" ,
2120+ "node_config.0.kubelet_config.0.topology_manager.0.scope" , "pod" ),
2121+ ),
2122+ },
2123+ {
2124+ ResourceName : "google_container_cluster.with_kubelet_config" ,
2125+ ImportState : true ,
2126+ ImportStateVerify : true ,
2127+ ImportStateVerifyIgnore : []string {"deletion_protection" },
2128+ },
2129+ },
2130+ })
2131+ }
2132+
20712133func TestAccContainerCluster_withNodeConfigFastSocket (t * testing.T ) {
20722134 t .Parallel ()
20732135
@@ -8516,7 +8578,6 @@ resource "google_container_cluster" "with_node_config_kubelet_config_settings_in
85168578 node_pool {
85178579 name = "%s"
85188580 initial_node_count = 1
8519-
85208581 node_config {
85218582 machine_type = "n1-standard-1"
85228583 kubelet_config {
@@ -14756,3 +14817,92 @@ resource "google_container_cluster" "primary" {
1475614817}
1475714818` , clusterName , networkName , subnetworkName , unauthenticated , authenticated )
1475814819}
14820+
14821+ func TestAccContainerCluster_withKubeletResourceManagerConfig (t * testing.T ) {
14822+ t .Parallel ()
14823+
14824+ clusterName := fmt .Sprintf ("tf-test-cluster-%s" , acctest .RandString (t , 10 ))
14825+ networkName := acctest .BootstrapSharedTestNetwork (t , "gke-cluster" )
14826+ subnetworkName := acctest .BootstrapSubnet (t , "gke-cluster" , networkName )
14827+
14828+ acctest .VcrTest (t , resource.TestCase {
14829+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
14830+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
14831+ CheckDestroy : testAccCheckContainerClusterDestroyProducer (t ),
14832+ Steps : []resource.TestStep {
14833+ {
14834+ Config : testAccContainerCluster_withKubeletConfig (clusterName , networkName , subnetworkName , "none" , "None" , "best-effort" , "container" ),
14835+ Check : resource .ComposeTestCheckFunc (
14836+ resource .TestCheckResourceAttr (
14837+ "google_container_cluster.with_kubelet_config" ,
14838+ "node_config.0.kubelet_config.0.cpu_manager_policy" , "none" ),
14839+ resource .TestCheckResourceAttr (
14840+ "google_container_cluster.with_kubelet_config" ,
14841+ "node_config.0.kubelet_config.0.memory_manager.0.policy" , "None" ),
14842+ resource .TestCheckResourceAttr (
14843+ "google_container_cluster.with_kubelet_config" ,
14844+ "node_config.0.kubelet_config.0.topology_manager.0.policy" , "best-effort" ),
14845+ resource .TestCheckResourceAttr (
14846+ "google_container_cluster.with_kubelet_config" ,
14847+ "node_config.0.kubelet_config.0.topology_manager.0.scope" , "container" ),
14848+ ),
14849+ },
14850+ {
14851+ ResourceName : "google_container_cluster.with_kubelet_config" ,
14852+ ImportState : true ,
14853+ ImportStateVerify : true ,
14854+ ImportStateVerifyIgnore : []string {"deletion_protection" },
14855+ },
14856+ {
14857+ Config : testAccContainerCluster_withKubeletConfig (clusterName , networkName , subnetworkName , "static" , "Static" , "single-numa-node" , "container" ),
14858+ Check : resource .ComposeTestCheckFunc (
14859+ resource .TestCheckResourceAttr (
14860+ "google_container_cluster.with_kubelet_config" ,
14861+ "node_config.0.kubelet_config.0.cpu_manager_policy" , "static" ),
14862+ resource .TestCheckResourceAttr (
14863+ "google_container_cluster.with_kubelet_config" ,
14864+ "node_config.0.kubelet_config.0.memory_manager.0.policy" , "Static" ),
14865+ resource .TestCheckResourceAttr (
14866+ "google_container_cluster.with_kubelet_config" ,
14867+ "node_config.0.kubelet_config.0.topology_manager.0.policy" , "single-numa-node" ),
14868+ resource .TestCheckResourceAttr (
14869+ "google_container_cluster.with_kubelet_config" ,
14870+ "node_config.0.kubelet_config.0.topology_manager.0.scope" , "container" ),
14871+ ),
14872+ },
14873+ {
14874+ ResourceName : "google_container_cluster.with_kubelet_config" ,
14875+ ImportState : true ,
14876+ ImportStateVerify : true ,
14877+ ImportStateVerifyIgnore : []string {"deletion_protection" },
14878+ },
14879+ },
14880+ })
14881+ }
14882+
14883+ func testAccContainerCluster_withKubeletConfig (clusterName , networkName , subnetworkName , cpuManagerPolicy , memoryManagerPolicy , topologyManagerPolicy , topologyManagerScope string ) string {
14884+ return fmt .Sprintf (`
14885+ resource "google_container_cluster" "with_kubelet_config" {
14886+ name = %q
14887+ location = "us-central1-a"
14888+ initial_node_count = 1
14889+ network = %q
14890+ subnetwork = %q
14891+ deletion_protection = false
14892+
14893+ node_config {
14894+ machine_type = "c4-standard-2"
14895+ kubelet_config {
14896+ cpu_manager_policy = %q
14897+ memory_manager {
14898+ policy = %q
14899+ }
14900+ topology_manager {
14901+ policy = %q
14902+ scope = %q
14903+ }
14904+ }
14905+ }
14906+ }
14907+ ` , clusterName , networkName , subnetworkName , cpuManagerPolicy , memoryManagerPolicy , topologyManagerPolicy , topologyManagerScope )
14908+ }
0 commit comments