Skip to content

Commit 51e02c2

Browse files
committed
add to node_config in 2 places as well
1 parent f74f08b commit 51e02c2

File tree

9 files changed

+203
-0
lines changed

9 files changed

+203
-0
lines changed

autogen/main/cluster.tf.tmpl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,16 @@ resource "google_container_cluster" "primary" {
530530
}
531531
}
532532

533+
# In the case of the default pool use the module level variable as a
534+
# fallback if it's not set explicitly for this pool.
535+
dynamic "kubelet_config" {
536+
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)] : []
537+
538+
content {
539+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
540+
}
541+
}
542+
533543
service_account = lookup(var.node_pools[0], "service_account", local.service_account)
534544

535545
tags = concat(
@@ -905,6 +915,14 @@ resource "google_container_node_pool" "windows_pools" {
905915
enabled = gvnic.value
906916
}
907917
}
918+
# In this case, only try to override if it's set explicitly for this pool.
919+
dynamic "kubelet_config" {
920+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
921+
922+
content {
923+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
924+
}
925+
}
908926
dynamic "reservation_affinity" {
909927
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
910928
content {

cluster.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,16 @@ resource "google_container_cluster" "primary" {
407407
}
408408
}
409409

410+
# In the case of the default pool use the module level variable as a
411+
# fallback if it's not set explicitly for this pool.
412+
dynamic "kubelet_config" {
413+
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)] : []
414+
415+
content {
416+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
417+
}
418+
}
419+
410420
service_account = lookup(var.node_pools[0], "service_account", local.service_account)
411421

412422
tags = concat(
@@ -612,6 +622,14 @@ resource "google_container_node_pool" "pools" {
612622
enabled = gvnic.value
613623
}
614624
}
625+
# In this case, only try to override if it's set explicitly for this pool.
626+
dynamic "kubelet_config" {
627+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
628+
629+
content {
630+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
631+
}
632+
}
615633
dynamic "reservation_affinity" {
616634
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
617635
content {
@@ -903,6 +921,14 @@ resource "google_container_node_pool" "windows_pools" {
903921
enabled = gvnic.value
904922
}
905923
}
924+
# In this case, only try to override if it's set explicitly for this pool.
925+
dynamic "kubelet_config" {
926+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
927+
928+
content {
929+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
930+
}
931+
}
906932
dynamic "reservation_affinity" {
907933
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
908934
content {

modules/beta-private-cluster-update-variant/cluster.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {

modules/beta-private-cluster/cluster.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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(
@@ -691,6 +701,14 @@ resource "google_container_node_pool" "pools" {
691701
enabled = gvnic.value
692702
}
693703
}
704+
# In this case, only try to override if it's set explicitly for this pool.
705+
dynamic "kubelet_config" {
706+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
707+
708+
content {
709+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
710+
}
711+
}
694712
dynamic "reservation_affinity" {
695713
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
696714
content {
@@ -995,6 +1013,14 @@ resource "google_container_node_pool" "windows_pools" {
9951013
enabled = gvnic.value
9961014
}
9971015
}
1016+
# In this case, only try to override if it's set explicitly for this pool.
1017+
dynamic "kubelet_config" {
1018+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
1019+
1020+
content {
1021+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
1022+
}
1023+
}
9981024
dynamic "reservation_affinity" {
9991025
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
10001026
content {

modules/beta-public-cluster-update-variant/cluster.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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(
@@ -755,6 +765,14 @@ resource "google_container_node_pool" "pools" {
755765
enabled = gvnic.value
756766
}
757767
}
768+
# In this case, only try to override if it's set explicitly for this pool.
769+
dynamic "kubelet_config" {
770+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
771+
772+
content {
773+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
774+
}
775+
}
758776
dynamic "reservation_affinity" {
759777
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
760778
content {
@@ -1060,6 +1078,14 @@ resource "google_container_node_pool" "windows_pools" {
10601078
enabled = gvnic.value
10611079
}
10621080
}
1081+
# In this case, only try to override if it's set explicitly for this pool.
1082+
dynamic "kubelet_config" {
1083+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
1084+
1085+
content {
1086+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
1087+
}
1088+
}
10631089
dynamic "reservation_affinity" {
10641090
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
10651091
content {

modules/beta-public-cluster/cluster.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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(
@@ -670,6 +680,14 @@ resource "google_container_node_pool" "pools" {
670680
enabled = gvnic.value
671681
}
672682
}
683+
# In this case, only try to override if it's set explicitly for this pool.
684+
dynamic "kubelet_config" {
685+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
686+
687+
content {
688+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
689+
}
690+
}
673691
dynamic "reservation_affinity" {
674692
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
675693
content {
@@ -974,6 +992,14 @@ resource "google_container_node_pool" "windows_pools" {
974992
enabled = gvnic.value
975993
}
976994
}
995+
# In this case, only try to override if it's set explicitly for this pool.
996+
dynamic "kubelet_config" {
997+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
998+
999+
content {
1000+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
1001+
}
1002+
}
9771003
dynamic "reservation_affinity" {
9781004
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
9791005
content {

modules/private-cluster-update-variant/cluster.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,16 @@ resource "google_container_cluster" "primary" {
407407
}
408408
}
409409

410+
# In the case of the default pool use the module level variable as a
411+
# fallback if it's not set explicitly for this pool.
412+
dynamic "kubelet_config" {
413+
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)] : []
414+
415+
content {
416+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
417+
}
418+
}
419+
410420
service_account = lookup(var.node_pools[0], "service_account", local.service_account)
411421

412422
tags = concat(
@@ -717,6 +727,14 @@ resource "google_container_node_pool" "pools" {
717727
enabled = gvnic.value
718728
}
719729
}
730+
# In this case, only try to override if it's set explicitly for this pool.
731+
dynamic "kubelet_config" {
732+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
733+
734+
content {
735+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
736+
}
737+
}
720738
dynamic "reservation_affinity" {
721739
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
722740
content {
@@ -1009,6 +1027,14 @@ resource "google_container_node_pool" "windows_pools" {
10091027
enabled = gvnic.value
10101028
}
10111029
}
1030+
# In this case, only try to override if it's set explicitly for this pool.
1031+
dynamic "kubelet_config" {
1032+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
1033+
1034+
content {
1035+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
1036+
}
1037+
}
10121038
dynamic "reservation_affinity" {
10131039
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
10141040
content {

modules/private-cluster/cluster.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,16 @@ resource "google_container_cluster" "primary" {
407407
}
408408
}
409409

410+
# In the case of the default pool use the module level variable as a
411+
# fallback if it's not set explicitly for this pool.
412+
dynamic "kubelet_config" {
413+
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)] : []
414+
415+
content {
416+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
417+
}
418+
}
419+
410420
service_account = lookup(var.node_pools[0], "service_account", local.service_account)
411421

412422
tags = concat(
@@ -633,6 +643,14 @@ resource "google_container_node_pool" "pools" {
633643
enabled = gvnic.value
634644
}
635645
}
646+
# In this case, only try to override if it's set explicitly for this pool.
647+
dynamic "kubelet_config" {
648+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
649+
650+
content {
651+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
652+
}
653+
}
636654
dynamic "reservation_affinity" {
637655
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
638656
content {
@@ -924,6 +942,14 @@ resource "google_container_node_pool" "windows_pools" {
924942
enabled = gvnic.value
925943
}
926944
}
945+
# In this case, only try to override if it's set explicitly for this pool.
946+
dynamic "kubelet_config" {
947+
for_each = lookup(each.value, "insecure_kubelet_readonly_port_enabled", null) != null ? [each.value.insecure_kubelet_readonly_port_enabled] : []
948+
949+
content {
950+
insecure_kubelet_readonly_port_enabled = upper(tostring(kubelet_config.value))
951+
}
952+
}
927953
dynamic "reservation_affinity" {
928954
for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : []
929955
content {

test/integration/private_zonal_with_networking/testdata/TestPrivateZonalWithNetworking.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@
107107
"diskSizeGb": 100,
108108
"diskType": "pd-balanced",
109109
"imageType": "COS_CONTAINERD",
110+
"kubeletConfig": {
111+
"insecureKubeletReadonlyPortEnabled": false
112+
},
110113
"loggingConfig": {
111114
"variantConfig": {
112115
"variant": "DEFAULT"

0 commit comments

Comments
 (0)