Skip to content

Commit

Permalink
feat: bump kubelet config to ga + minor doc fixes (#1994)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Peabody <[email protected]>
  • Loading branch information
DrFaust92 and apeabody authored Jul 19, 2024
1 parent 9d6a400 commit 6bd1bc1
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 72 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ The node_pools variable takes the following parameters:
| autoscaling | Configuration required by cluster autoscaler to adjust the size of the node pool to the current cluster usage | true | Optional |
| auto_upgrade | Whether the nodes will be automatically upgraded | true (if cluster is regional) | Optional |
| boot_disk_kms_key | The Customer Managed Encryption Key used to encrypt the boot disk attached to each node in the node pool. This should be of the form projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. | " " | Optional |
| cpu_manager_policy | The CPU manager policy on the node. One of "none" or "static". | "static" | Optional |
| cpu_cfs_quota | Enforces the Pod's CPU limit. Setting this value to false means that the CPU limits for Pods are ignored | null | Optional |
| cpu_cfs_quota_period | The CPU CFS quota period value, which specifies the period of how often a cgroup's access to CPU resources should be reallocated | null | Optional |
| pod_pids_limit | Controls the maximum number of processes allowed to run in a pod. The value must be greater than or equal to 1024 and less than 4194304. | null | Optional |
| disk_size_gb | Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB | 100 | Optional |
| disk_type | Type of the disk attached to each node (e.g. 'pd-standard' or 'pd-ssd') | pd-standard | Optional |
| effect | Effect for the taint | | Required |
Expand Down Expand Up @@ -330,6 +334,9 @@ The node_pools variable takes the following parameters:
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with total limits. | 1 | Optional |
| total_min_count | Total minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits. | null | Optional |
| name | The name of the node pool | | Required |
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
| pod_range | The name of the secondary range for pod IPs. | | Optional |
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |
Expand Down
6 changes: 2 additions & 4 deletions autogen/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ The node_pools variable takes the following parameters:
| autoscaling | Configuration required by cluster autoscaler to adjust the size of the node pool to the current cluster usage | true | Optional |
| auto_upgrade | Whether the nodes will be automatically upgraded | true (if cluster is regional) | Optional |
| boot_disk_kms_key | The Customer Managed Encryption Key used to encrypt the boot disk attached to each node in the node pool. This should be of the form projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. | " " | Optional |
{% if beta_cluster %}
| cpu_manager_policy | The CPU manager policy on the node. One of "none" or "static". | "static" | Optional |
| cpu_cfs_quota | Enforces the Pod's CPU limit. Setting this value to false means that the CPU limits for Pods are ignored | null | Optional |
| cpu_cfs_quota_period | The CPU CFS quota period value, which specifies the period of how often a cgroup's access to CPU resources should be reallocated | null | Optional |
| pod_pids_limit | Controls the maximum number of processes allowed to run in a pod. The value must be greater than or equal to 1024 and less than 4194304. | null | Optional |
{% if beta_cluster %}
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
{% endif %}
| disk_size_gb | Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB | 100 | Optional |
Expand Down Expand Up @@ -239,13 +239,11 @@ The node_pools variable takes the following parameters:
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with total limits. | 1 | Optional |
| total_min_count | Total minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits. | null | Optional |
| name | The name of the node pool | | Required |
{% if beta_cluster %}
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | Optional |
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
| pod_range | The name of the secondary range for pod IPs. | | Optional |
{% if not private_cluster %}
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |
{% endif %}
{% endif %}
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |
Expand Down
16 changes: 8 additions & 8 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1000,14 +1000,6 @@ resource "google_container_node_pool" "windows_pools" {
}
}

{% if beta_cluster %}
dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "kubelet_config" {
for_each = length(setintersection(
keys(each.value),
Expand All @@ -1021,6 +1013,14 @@ resource "google_container_node_pool" "windows_pools" {
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
}
}
{% if beta_cluster %}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}
{% endif %}

{% if i == 0 %}
Expand Down
26 changes: 26 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,19 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "kubelet_config" {
for_each = length(setintersection(
keys(each.value),
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period", "pod_pids_limit"]
)) != 0 ? [1] : []

content {
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
}
}

dynamic "linux_node_config" {
for_each = length(merge(
Expand Down Expand Up @@ -968,6 +981,19 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "kubelet_config" {
for_each = length(setintersection(
keys(each.value),
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period", "pod_pids_limit"]
)) != 0 ? [1] : []

content {
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
}
}


boot_disk_kms_key = lookup(each.value, "boot_disk_kms_key", "")
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ The node_pools variable takes the following parameters:
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with total limits. | 1 | Optional |
| total_min_count | Total minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits. | null | Optional |
| name | The name of the node pool | | Required |
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | Optional |
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
| pod_range | The name of the secondary range for pod IPs. | | Optional |
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
Expand Down
28 changes: 14 additions & 14 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -876,13 +876,6 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "kubelet_config" {
for_each = length(setintersection(
keys(each.value),
Expand All @@ -897,6 +890,13 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "linux_node_config" {
for_each = length(merge(
local.node_pools_linux_node_configs_sysctls["all"],
Expand Down Expand Up @@ -1162,13 +1162,6 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "kubelet_config" {
for_each = length(setintersection(
keys(each.value),
Expand All @@ -1183,6 +1176,13 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}


boot_disk_kms_key = lookup(each.value, "boot_disk_kms_key", "")

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ The node_pools variable takes the following parameters:
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with total limits. | 1 | Optional |
| total_min_count | Total minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits. | null | Optional |
| name | The name of the node pool | | Required |
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | Optional |
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
| pod_range | The name of the secondary range for pod IPs. | | Optional |
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
Expand Down
28 changes: 14 additions & 14 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -797,13 +797,6 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "kubelet_config" {
for_each = length(setintersection(
keys(each.value),
Expand All @@ -818,6 +811,13 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "linux_node_config" {
for_each = length(merge(
local.node_pools_linux_node_configs_sysctls["all"],
Expand Down Expand Up @@ -1082,13 +1082,6 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "kubelet_config" {
for_each = length(setintersection(
keys(each.value),
Expand All @@ -1103,6 +1096,13 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}


boot_disk_kms_key = lookup(each.value, "boot_disk_kms_key", "")

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ The node_pools variable takes the following parameters:
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with total limits. | 1 | Optional |
| total_min_count | Total minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits. | null | Optional |
| name | The name of the node pool | | Required |
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | Optional |
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
| pod_range | The name of the secondary range for pod IPs. | | Optional |
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
Expand Down
28 changes: 14 additions & 14 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -857,13 +857,6 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "kubelet_config" {
for_each = length(setintersection(
keys(each.value),
Expand All @@ -878,6 +871,13 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "linux_node_config" {
for_each = length(merge(
local.node_pools_linux_node_configs_sysctls["all"],
Expand Down Expand Up @@ -1143,13 +1143,6 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "kubelet_config" {
for_each = length(setintersection(
keys(each.value),
Expand All @@ -1164,6 +1157,13 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}


boot_disk_kms_key = lookup(each.value, "boot_disk_kms_key", "")

Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ The node_pools variable takes the following parameters:
| min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with total limits. | 1 | Optional |
| total_min_count | Total minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits. | null | Optional |
| name | The name of the node pool | | Required |
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | Optional |
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
| pod_range | The name of the secondary range for pod IPs. | | Optional |
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
Expand Down
28 changes: 14 additions & 14 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -778,13 +778,6 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "kubelet_config" {
for_each = length(setintersection(
keys(each.value),
Expand All @@ -799,6 +792,13 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "linux_node_config" {
for_each = length(merge(
local.node_pools_linux_node_configs_sysctls["all"],
Expand Down Expand Up @@ -1063,13 +1063,6 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}

dynamic "kubelet_config" {
for_each = length(setintersection(
keys(each.value),
Expand All @@ -1084,6 +1077,13 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "sandbox_config" {
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
content {
sandbox_type = sandbox_config.value
}
}


boot_disk_kms_key = lookup(each.value, "boot_disk_kms_key", "")

Expand Down
Loading

0 comments on commit 6bd1bc1

Please sign in to comment.