Skip to content

Commit

Permalink
Merge pull request #49 from nurairasia/gke-module-fix
Browse files Browse the repository at this point in the history
Gke module fix - node_taint bug fix , kubelet_config fix , network_config fix
  • Loading branch information
nurairasia authored Feb 14, 2025
2 parents 9b506a6 + 26b2ed5 commit 4b7a344
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
19 changes: 18 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ resource "google_container_node_pool" "node_pools" {
max_surge = each.value.max_surge
max_unavailable = each.value.max_unavailable
}
dynamic "network_config" {
for_each = each.value.network_config == null ? [] : [each.value.network_config]
iterator = network_config
content {
create_pod_range = false
pod_range = network_config.value.pod_range
}
}
node_config {
machine_type = each.value.machine_type
disk_type = each.value.disk_type
Expand All @@ -229,7 +237,7 @@ resource "google_container_node_pool" "node_pools" {
iterator = node_taint
content {
key = node_taint.value.key
value = ndoe_taint.value.key
value = node_taint.value.value
effect = node_taint.value.effect
}
}
Expand All @@ -250,6 +258,15 @@ resource "google_container_node_pool" "node_pools" {
workload_metadata_config {
mode = each.value.enable_gke_metadata_server && var.enable_workload_identity ? "GKE_METADATA" : "GCE_METADATA"
}
dynamic "kubelet_config" {
for_each = each.value.kubelet_config == null ? [] : [each.value.kubelet_config]
iterator = kubelet_config
content {
cpu_cfs_quota = kubelet_config.value.cpu_cfs_quota
cpu_manager_policy = kubelet_config.value.cpu_manager_policy
pod_pids_limit = kubelet_config.value.pod_pids_limit
}
}
}
lifecycle {
ignore_changes = [
Expand Down
4 changes: 4 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ variable "node_pools" {
enable_gke_metadata_server = bool
node_metadatas = map(string)
gpu_type = map(string)
kubelet_config = object({ cpu_cfs_quota = bool, cpu_manager_policy = string, pod_pids_limit = number })
network_config = object({ pod_range = string })
}))
default = [{
node_pool_name = "gkenp-a"
Expand All @@ -341,6 +343,8 @@ variable "node_pools" {
enable_gke_metadata_server = false
node_metadatas = {}
gpu_type = null
kubelet_config = null
network_config = null
}]
}

Expand Down

0 comments on commit 4b7a344

Please sign in to comment.