Linux sysctls configuration and Kubelet config (#388)

* Linux sysctls configuration and Kubelet config

* Fix terraform linting issues

* Updated README.md

* Updated Kubelet config object type

* Update readme

Co-authored-by: Sergio Tejón <stejon@freepik.com>
Co-authored-by: Julio Castillo <jccb@google.com>
This commit is contained in:
sergiotejon 2021-12-16 13:32:17 +01:00 committed by GitHub
parent 0fe5b6b03f
commit 6a42929df3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 0 deletions

View File

@ -45,6 +45,8 @@ module "cluster-1-nodepool-1" {
| *autoscaling_config* | Optional autoscaling configuration. | <code title="object&#40;&#123;&#10;min_node_count &#61; number&#10;max_node_count &#61; number&#10;&#125;&#41;">object({...})</code> | | <code title="">null</code> |
| *gke_version* | Kubernetes nodes version. Ignored if auto_upgrade is set in management_config. | <code title="">string</code> | | <code title="">null</code> |
| *initial_node_count* | Initial number of nodes for the pool. | <code title="">number</code> | | <code title="">1</code> |
| *kubelet_config* | Kubelet configuration. | <code title="object&#40;&#123;&#10;cpu_cfs_quota &#61; string&#10;cpu_cfs_quota_period &#61; string&#10;cpu_manager_policy &#61; string&#10;&#125;&#41;">object({...})</code> | | <code title="">null</code> |
| *linux_node_config_sysctls* | Linux node configuration. | <code title="map&#40;string&#41;">map(string)</code> | | <code title="">null</code> |
| *management_config* | Optional node management configuration. | <code title="object&#40;&#123;&#10;auto_repair &#61; bool&#10;auto_upgrade &#61; bool&#10;&#125;&#41;">object({...})</code> | | <code title="">null</code> |
| *max_pods_per_node* | Maximum number of pods per node. | <code title="">number</code> | | <code title="">null</code> |
| *name* | Optional nodepool name. | <code title="">string</code> | | <code title="">null</code> |

View File

@ -144,6 +144,23 @@ resource "google_container_node_pool" "nodepool" {
mode = var.workload_metadata_config
}
dynamic "kubelet_config" {
for_each = var.kubelet_config != null ? [var.kubelet_config] : []
iterator = config
content {
cpu_manager_policy = config.value.cpu_manager_policy
cpu_cfs_quota = config.value.cpu_cfs_quota
cpu_cfs_quota_period = config.value.cpu_cfs_quota_period
}
}
dynamic "linux_node_config" {
for_each = var.linux_node_config_sysctls != null ? [var.linux_node_config_sysctls] : []
iterator = config
content {
sysctls = config.value
}
}
}
dynamic "autoscaling" {

View File

@ -40,6 +40,22 @@ variable "initial_node_count" {
default = 1
}
variable "kubelet_config" {
description = "Kubelet configuration."
type = object({
cpu_cfs_quota = string
cpu_cfs_quota_period = string
cpu_manager_policy = string
})
default = null
}
variable "linux_node_config_sysctls" {
description = "Linux node configuration."
type = map(string)
default = null
}
variable "location" {
description = "Cluster location."
type = string