@@ -453,6 +453,16 @@ resource "google_container_cluster" "primary" {
453453 }
454454 }
455455
456+ # In the case of the default pool use the module level variable as a
457+ # fallback if it's not set explicitly for this pool.
458+ dynamic "kubelet_config" {
459+ for_each = lookup (var. node_pools [0 ], " insecure_kubelet_readonly_port_enabled" , var. insecure_kubelet_readonly_port_enabled ) != null ? [lookup (var. node_pools [0 ], " insecure_kubelet_readonly_port_enabled" , var. insecure_kubelet_readonly_port_enabled )] : []
460+
461+ content {
462+ insecure_kubelet_readonly_port_enabled = upper (tostring (kubelet_config. value ))
463+ }
464+ }
465+
456466 service_account = lookup (var. node_pools [0 ], " service_account" , local. service_account )
457467
458468 tags = concat (
@@ -776,6 +786,14 @@ resource "google_container_node_pool" "pools" {
776786 enabled = gvnic. value
777787 }
778788 }
789+ # In this case, only try to override if it's set explicitly for this pool.
790+ dynamic "kubelet_config" {
791+ for_each = lookup (each. value , " insecure_kubelet_readonly_port_enabled" , null ) != null ? [each . value . insecure_kubelet_readonly_port_enabled ] : []
792+
793+ content {
794+ insecure_kubelet_readonly_port_enabled = upper (tostring (kubelet_config. value ))
795+ }
796+ }
779797 dynamic "reservation_affinity" {
780798 for_each = lookup (each. value , " queued_provisioning" , false ) || lookup (each. value , " consume_reservation_type" , " " ) != " " ? [each . value ] : []
781799 content {
@@ -1081,6 +1099,14 @@ resource "google_container_node_pool" "windows_pools" {
10811099 enabled = gvnic. value
10821100 }
10831101 }
1102+ # In this case, only try to override if it's set explicitly for this pool.
1103+ dynamic "kubelet_config" {
1104+ for_each = lookup (each. value , " insecure_kubelet_readonly_port_enabled" , null ) != null ? [each . value . insecure_kubelet_readonly_port_enabled ] : []
1105+
1106+ content {
1107+ insecure_kubelet_readonly_port_enabled = upper (tostring (kubelet_config. value ))
1108+ }
1109+ }
10841110 dynamic "reservation_affinity" {
10851111 for_each = lookup (each. value , " queued_provisioning" , false ) || lookup (each. value , " consume_reservation_type" , " " ) != " " ? [each . value ] : []
10861112 content {
0 commit comments