Skip to content

Commit 6bd1bc1

Browse files
DrFaust92apeabody
andauthored
feat: bump kubelet config to ga + minor doc fixes (terraform-google-modules#1994)
Co-authored-by: Andrew Peabody <[email protected]>
1 parent 9d6a400 commit 6bd1bc1

File tree

16 files changed

+167
-72
lines changed

16 files changed

+167
-72
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ The node_pools variable takes the following parameters:
298298
| autoscaling | Configuration required by cluster autoscaler to adjust the size of the node pool to the current cluster usage | true | Optional |
299299
| auto_upgrade | Whether the nodes will be automatically upgraded | true (if cluster is regional) | Optional |
300300
| 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 |
301+
| cpu_manager_policy | The CPU manager policy on the node. One of "none" or "static". | "static" | Optional |
302+
| 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 |
303+
| 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 |
304+
| 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 |
301305
| disk_size_gb | Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB | 100 | Optional |
302306
| disk_type | Type of the disk attached to each node (e.g. 'pd-standard' or 'pd-ssd') | pd-standard | Optional |
303307
| effect | Effect for the taint | | Required |
@@ -330,6 +334,9 @@ The node_pools variable takes the following parameters:
330334
| 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 |
331335
| 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 |
332336
| name | The name of the node pool | | Required |
337+
| 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 |
338+
| pod_range | The name of the secondary range for pod IPs. | | Optional |
339+
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |
333340
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
334341
| 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 |
335342
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |

autogen/main/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ The node_pools variable takes the following parameters:
197197
| autoscaling | Configuration required by cluster autoscaler to adjust the size of the node pool to the current cluster usage | true | Optional |
198198
| auto_upgrade | Whether the nodes will be automatically upgraded | true (if cluster is regional) | Optional |
199199
| 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 |
200-
{% if beta_cluster %}
201200
| cpu_manager_policy | The CPU manager policy on the node. One of "none" or "static". | "static" | Optional |
202201
| 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 |
203202
| 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 |
204203
| 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 |
204+
{% if beta_cluster %}
205205
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
206206
{% endif %}
207207
| disk_size_gb | Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB | 100 | Optional |
@@ -239,13 +239,11 @@ The node_pools variable takes the following parameters:
239239
| 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 |
240240
| 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 |
241241
| name | The name of the node pool | | Required |
242-
{% if beta_cluster %}
243-
| 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 |
242+
| 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 |
244243
| pod_range | The name of the secondary range for pod IPs. | | Optional |
245244
{% if not private_cluster %}
246245
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |
247246
{% endif %}
248-
{% endif %}
249247
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
250248
| 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 |
251249
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |

autogen/main/cluster.tf.tmpl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,14 +1000,6 @@ resource "google_container_node_pool" "windows_pools" {
10001000
}
10011001
}
10021002

1003-
{% if beta_cluster %}
1004-
dynamic "sandbox_config" {
1005-
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
1006-
content {
1007-
sandbox_type = sandbox_config.value
1008-
}
1009-
}
1010-
10111003
dynamic "kubelet_config" {
10121004
for_each = length(setintersection(
10131005
keys(each.value),
@@ -1021,6 +1013,14 @@ resource "google_container_node_pool" "windows_pools" {
10211013
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
10221014
}
10231015
}
1016+
{% if beta_cluster %}
1017+
1018+
dynamic "sandbox_config" {
1019+
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
1020+
content {
1021+
sandbox_type = sandbox_config.value
1022+
}
1023+
}
10241024
{% endif %}
10251025

10261026
{% if i == 0 %}

cluster.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,19 @@ resource "google_container_node_pool" "pools" {
709709
}
710710
}
711711

712+
dynamic "kubelet_config" {
713+
for_each = length(setintersection(
714+
keys(each.value),
715+
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period", "pod_pids_limit"]
716+
)) != 0 ? [1] : []
717+
718+
content {
719+
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
720+
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
721+
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
722+
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
723+
}
724+
}
712725

713726
dynamic "linux_node_config" {
714727
for_each = length(merge(
@@ -968,6 +981,19 @@ resource "google_container_node_pool" "windows_pools" {
968981
}
969982
}
970983

984+
dynamic "kubelet_config" {
985+
for_each = length(setintersection(
986+
keys(each.value),
987+
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period", "pod_pids_limit"]
988+
)) != 0 ? [1] : []
989+
990+
content {
991+
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "static")
992+
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", null)
993+
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", null)
994+
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
995+
}
996+
}
971997

972998

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

modules/beta-private-cluster-update-variant/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ The node_pools variable takes the following parameters:
392392
| 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 |
393393
| 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 |
394394
| name | The name of the node pool | | Required |
395-
| 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 |
395+
| 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 |
396396
| pod_range | The name of the secondary range for pod IPs. | | Optional |
397397
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
398398
| 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 |

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -876,13 +876,6 @@ resource "google_container_node_pool" "pools" {
876876
}
877877
}
878878

879-
dynamic "sandbox_config" {
880-
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
881-
content {
882-
sandbox_type = sandbox_config.value
883-
}
884-
}
885-
886879
dynamic "kubelet_config" {
887880
for_each = length(setintersection(
888881
keys(each.value),
@@ -897,6 +890,13 @@ resource "google_container_node_pool" "pools" {
897890
}
898891
}
899892

893+
dynamic "sandbox_config" {
894+
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
895+
content {
896+
sandbox_type = sandbox_config.value
897+
}
898+
}
899+
900900
dynamic "linux_node_config" {
901901
for_each = length(merge(
902902
local.node_pools_linux_node_configs_sysctls["all"],
@@ -1162,13 +1162,6 @@ resource "google_container_node_pool" "windows_pools" {
11621162
}
11631163
}
11641164

1165-
dynamic "sandbox_config" {
1166-
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
1167-
content {
1168-
sandbox_type = sandbox_config.value
1169-
}
1170-
}
1171-
11721165
dynamic "kubelet_config" {
11731166
for_each = length(setintersection(
11741167
keys(each.value),
@@ -1183,6 +1176,13 @@ resource "google_container_node_pool" "windows_pools" {
11831176
}
11841177
}
11851178

1179+
dynamic "sandbox_config" {
1180+
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
1181+
content {
1182+
sandbox_type = sandbox_config.value
1183+
}
1184+
}
1185+
11861186

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

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ The node_pools variable takes the following parameters:
370370
| 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 |
371371
| 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 |
372372
| name | The name of the node pool | | Required |
373-
| 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 |
373+
| 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 |
374374
| pod_range | The name of the secondary range for pod IPs. | | Optional |
375375
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
376376
| 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 |

modules/beta-private-cluster/cluster.tf

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -797,13 +797,6 @@ resource "google_container_node_pool" "pools" {
797797
}
798798
}
799799

800-
dynamic "sandbox_config" {
801-
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
802-
content {
803-
sandbox_type = sandbox_config.value
804-
}
805-
}
806-
807800
dynamic "kubelet_config" {
808801
for_each = length(setintersection(
809802
keys(each.value),
@@ -818,6 +811,13 @@ resource "google_container_node_pool" "pools" {
818811
}
819812
}
820813

814+
dynamic "sandbox_config" {
815+
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
816+
content {
817+
sandbox_type = sandbox_config.value
818+
}
819+
}
820+
821821
dynamic "linux_node_config" {
822822
for_each = length(merge(
823823
local.node_pools_linux_node_configs_sysctls["all"],
@@ -1082,13 +1082,6 @@ resource "google_container_node_pool" "windows_pools" {
10821082
}
10831083
}
10841084

1085-
dynamic "sandbox_config" {
1086-
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
1087-
content {
1088-
sandbox_type = sandbox_config.value
1089-
}
1090-
}
1091-
10921085
dynamic "kubelet_config" {
10931086
for_each = length(setintersection(
10941087
keys(each.value),
@@ -1103,6 +1096,13 @@ resource "google_container_node_pool" "windows_pools" {
11031096
}
11041097
}
11051098

1099+
dynamic "sandbox_config" {
1100+
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
1101+
content {
1102+
sandbox_type = sandbox_config.value
1103+
}
1104+
}
1105+
11061106

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

modules/beta-public-cluster-update-variant/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ The node_pools variable takes the following parameters:
379379
| 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 |
380380
| 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 |
381381
| name | The name of the node pool | | Required |
382-
| 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 |
382+
| 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 |
383383
| pod_range | The name of the secondary range for pod IPs. | | Optional |
384384
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |
385385
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -857,13 +857,6 @@ resource "google_container_node_pool" "pools" {
857857
}
858858
}
859859

860-
dynamic "sandbox_config" {
861-
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
862-
content {
863-
sandbox_type = sandbox_config.value
864-
}
865-
}
866-
867860
dynamic "kubelet_config" {
868861
for_each = length(setintersection(
869862
keys(each.value),
@@ -878,6 +871,13 @@ resource "google_container_node_pool" "pools" {
878871
}
879872
}
880873

874+
dynamic "sandbox_config" {
875+
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
876+
content {
877+
sandbox_type = sandbox_config.value
878+
}
879+
}
880+
881881
dynamic "linux_node_config" {
882882
for_each = length(merge(
883883
local.node_pools_linux_node_configs_sysctls["all"],
@@ -1143,13 +1143,6 @@ resource "google_container_node_pool" "windows_pools" {
11431143
}
11441144
}
11451145

1146-
dynamic "sandbox_config" {
1147-
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
1148-
content {
1149-
sandbox_type = sandbox_config.value
1150-
}
1151-
}
1152-
11531146
dynamic "kubelet_config" {
11541147
for_each = length(setintersection(
11551148
keys(each.value),
@@ -1164,6 +1157,13 @@ resource "google_container_node_pool" "windows_pools" {
11641157
}
11651158
}
11661159

1160+
dynamic "sandbox_config" {
1161+
for_each = tobool((lookup(each.value, "sandbox_enabled", var.sandbox_enabled))) ? ["gvisor"] : []
1162+
content {
1163+
sandbox_type = sandbox_config.value
1164+
}
1165+
}
1166+
11671167

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

0 commit comments

Comments
 (0)