Skip to content

Commit dd31f57

Browse files
apeabodyMaximF
authored andcommitted
fix: add kubelet_config to default-pool (terraform-google-modules#2147)
feat: use 'moved' block to address ConfigMap renaming chore: remove extra empty line
1 parent 2441b5b commit dd31f57

File tree

18 files changed

+180
-0
lines changed

18 files changed

+180
-0
lines changed

autogen/main/cluster.tf.tmpl

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

533+
dynamic "kubelet_config" {
534+
for_each = length(setintersection(
535+
keys(var.node_pools[0]),
536+
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period", "insecure_kubelet_readonly_port_enabled", "pod_pids_limit"]
537+
)) != 0 || var.insecure_kubelet_readonly_port_enabled != null ? [1] : []
538+
539+
content {
540+
cpu_manager_policy = lookup(var.node_pools[0], "cpu_manager_policy", "static")
541+
cpu_cfs_quota = lookup(var.node_pools[0], "cpu_cfs_quota", null)
542+
cpu_cfs_quota_period = lookup(var.node_pools[0], "cpu_cfs_quota_period", null)
543+
insecure_kubelet_readonly_port_enabled = lookup(var.node_pools[0], "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled) != null ? upper(tostring(lookup(var.node_pools[0], "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled))) : null
544+
pod_pids_limit = lookup(var.node_pools[0], "pod_pids_limit", null)
545+
}
546+
}
547+
533548
service_account = lookup(var.node_pools[0], "service_account", local.service_account)
534549

535550
tags = concat(

autogen/main/dns.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ EOF
6868
]
6969
}
7070

71+
# Fix the name typo in the previous ConfigMap creation call
72+
moved = {
73+
from = kubernetes_config_map_v1_data.kube-dns-upstream-namservers
74+
to = kubernetes_config_map_v1_data.kube-dns-upstream-nameservers
75+
}
76+
7177
resource "kubernetes_config_map_v1_data" "kube-dns-upstream-nameservers-and-stub-domains" {
7278
count = local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
7379

cluster.tf

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

410+
dynamic "kubelet_config" {
411+
for_each = length(setintersection(
412+
keys(var.node_pools[0]),
413+
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period", "insecure_kubelet_readonly_port_enabled", "pod_pids_limit"]
414+
)) != 0 || var.insecure_kubelet_readonly_port_enabled != null ? [1] : []
415+
416+
content {
417+
cpu_manager_policy = lookup(var.node_pools[0], "cpu_manager_policy", "static")
418+
cpu_cfs_quota = lookup(var.node_pools[0], "cpu_cfs_quota", null)
419+
cpu_cfs_quota_period = lookup(var.node_pools[0], "cpu_cfs_quota_period", null)
420+
insecure_kubelet_readonly_port_enabled = lookup(var.node_pools[0], "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled) != null ? upper(tostring(lookup(var.node_pools[0], "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled))) : null
421+
pod_pids_limit = lookup(var.node_pools[0], "pod_pids_limit", null)
422+
}
423+
}
424+
410425
service_account = lookup(var.node_pools[0], "service_account", local.service_account)
411426

412427
tags = concat(

dns.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ EOF
6464
]
6565
}
6666

67+
# Fix the name typo in the previous ConfigMap creation call
68+
moved = {
69+
from = kubernetes_config_map_v1_data.kube-dns-upstream-namservers
70+
to = kubernetes_config_map_v1_data.kube-dns-upstream-nameservers
71+
}
72+
6773
resource "kubernetes_config_map_v1_data" "kube-dns-upstream-nameservers-and-stub-domains" {
6874
count = local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
6975

modules/beta-autopilot-private-cluster/dns.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ EOF
6262
]
6363
}
6464

65+
# Fix the name typo in the previous ConfigMap creation call
66+
moved = {
67+
from = kubernetes_config_map_v1_data.kube-dns-upstream-namservers
68+
to = kubernetes_config_map_v1_data.kube-dns-upstream-nameservers
69+
}
70+
6571
resource "kubernetes_config_map_v1_data" "kube-dns-upstream-nameservers-and-stub-domains" {
6672
count = local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
6773

modules/beta-autopilot-public-cluster/dns.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ EOF
6262
]
6363
}
6464

65+
# Fix the name typo in the previous ConfigMap creation call
66+
moved = {
67+
from = kubernetes_config_map_v1_data.kube-dns-upstream-namservers
68+
to = kubernetes_config_map_v1_data.kube-dns-upstream-nameservers
69+
}
70+
6571
resource "kubernetes_config_map_v1_data" "kube-dns-upstream-nameservers-and-stub-domains" {
6672
count = local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
6773

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,21 @@ resource "google_container_cluster" "primary" {
453453
}
454454
}
455455

456+
dynamic "kubelet_config" {
457+
for_each = length(setintersection(
458+
keys(var.node_pools[0]),
459+
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period", "insecure_kubelet_readonly_port_enabled", "pod_pids_limit"]
460+
)) != 0 || var.insecure_kubelet_readonly_port_enabled != null ? [1] : []
461+
462+
content {
463+
cpu_manager_policy = lookup(var.node_pools[0], "cpu_manager_policy", "static")
464+
cpu_cfs_quota = lookup(var.node_pools[0], "cpu_cfs_quota", null)
465+
cpu_cfs_quota_period = lookup(var.node_pools[0], "cpu_cfs_quota_period", null)
466+
insecure_kubelet_readonly_port_enabled = lookup(var.node_pools[0], "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled) != null ? upper(tostring(lookup(var.node_pools[0], "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled))) : null
467+
pod_pids_limit = lookup(var.node_pools[0], "pod_pids_limit", null)
468+
}
469+
}
470+
456471
service_account = lookup(var.node_pools[0], "service_account", local.service_account)
457472

458473
tags = concat(

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ EOF
6464
]
6565
}
6666

67+
# Fix the name typo in the previous ConfigMap creation call
68+
moved = {
69+
from = kubernetes_config_map_v1_data.kube-dns-upstream-namservers
70+
to = kubernetes_config_map_v1_data.kube-dns-upstream-nameservers
71+
}
72+
6773
resource "kubernetes_config_map_v1_data" "kube-dns-upstream-nameservers-and-stub-domains" {
6874
count = local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
6975

modules/beta-private-cluster/cluster.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,21 @@ resource "google_container_cluster" "primary" {
453453
}
454454
}
455455

456+
dynamic "kubelet_config" {
457+
for_each = length(setintersection(
458+
keys(var.node_pools[0]),
459+
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period", "insecure_kubelet_readonly_port_enabled", "pod_pids_limit"]
460+
)) != 0 || var.insecure_kubelet_readonly_port_enabled != null ? [1] : []
461+
462+
content {
463+
cpu_manager_policy = lookup(var.node_pools[0], "cpu_manager_policy", "static")
464+
cpu_cfs_quota = lookup(var.node_pools[0], "cpu_cfs_quota", null)
465+
cpu_cfs_quota_period = lookup(var.node_pools[0], "cpu_cfs_quota_period", null)
466+
insecure_kubelet_readonly_port_enabled = lookup(var.node_pools[0], "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled) != null ? upper(tostring(lookup(var.node_pools[0], "insecure_kubelet_readonly_port_enabled", var.insecure_kubelet_readonly_port_enabled))) : null
467+
pod_pids_limit = lookup(var.node_pools[0], "pod_pids_limit", null)
468+
}
469+
}
470+
456471
service_account = lookup(var.node_pools[0], "service_account", local.service_account)
457472

458473
tags = concat(

modules/beta-private-cluster/dns.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ EOF
6464
]
6565
}
6666

67+
# Fix the name typo in the previous ConfigMap creation call
68+
moved = {
69+
from = kubernetes_config_map_v1_data.kube-dns-upstream-namservers
70+
to = kubernetes_config_map_v1_data.kube-dns-upstream-nameservers
71+
}
72+
6773
resource "kubernetes_config_map_v1_data" "kube-dns-upstream-nameservers-and-stub-domains" {
6874
count = local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
6975

0 commit comments

Comments
 (0)