From ece7a6d3859248fcf659a99c0683e9b1ae35c506 Mon Sep 17 00:00:00 2001 From: Karim Naufal Date: Sat, 16 Mar 2024 07:15:34 +0100 Subject: [PATCH] changed type of autoscaler timeout variable from string to number --- autoscaler-agents.tf | 30 +++++++++++++++--------------- kube.tf.example | 4 ++-- variables.tf | 7 ++++--- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/autoscaler-agents.tf b/autoscaler-agents.tf index 6e7c5613..3031ad0b 100644 --- a/autoscaler-agents.tf +++ b/autoscaler-agents.tf @@ -27,21 +27,21 @@ locals { autoscaler_yaml = length(var.autoscaler_nodepools) == 0 ? "" : templatefile( "${path.module}/templates/autoscaler.yaml.tpl", { - cloudinit_config = local.isUsingLegacyConfig ? base64encode(data.cloudinit_config.autoscaler_legacy_config[0].rendered) : "" - ca_image = var.cluster_autoscaler_image - ca_version = var.cluster_autoscaler_version - cluster_autoscaler_extra_args = var.cluster_autoscaler_extra_args - cluster_autoscaler_log_level = var.cluster_autoscaler_log_level - cluster_autoscaler_log_to_stderr = var.cluster_autoscaler_log_to_stderr - cluster_autoscaler_stderr_threshold = var.cluster_autoscaler_stderr_threshold - cluster_autoscaler_server_creation_timeout = var.cluster_autoscaler_server_creation_timeout - ssh_key = local.hcloud_ssh_key_id - ipv4_subnet_id = data.hcloud_network.k3s.id - snapshot_id = local.first_nodepool_snapshot_id - cluster_config = base64encode(jsonencode(local.cluster_config)) - firewall_id = hcloud_firewall.k3s.id - cluster_name = local.cluster_prefix - node_pools = var.autoscaler_nodepools + cloudinit_config = local.isUsingLegacyConfig ? base64encode(data.cloudinit_config.autoscaler_legacy_config[0].rendered) : "" + ca_image = var.cluster_autoscaler_image + ca_version = var.cluster_autoscaler_version + cluster_autoscaler_extra_args = var.cluster_autoscaler_extra_args + cluster_autoscaler_log_level = var.cluster_autoscaler_log_level + cluster_autoscaler_log_to_stderr = var.cluster_autoscaler_log_to_stderr + cluster_autoscaler_stderr_threshold = var.cluster_autoscaler_stderr_threshold + cluster_autoscaler_server_creation_timeout = tostring(var.cluster_autoscaler_server_creation_timeout) + ssh_key = local.hcloud_ssh_key_id + ipv4_subnet_id = data.hcloud_network.k3s.id + snapshot_id = local.first_nodepool_snapshot_id + cluster_config = base64encode(jsonencode(local.cluster_config)) + firewall_id = hcloud_firewall.k3s.id + cluster_name = local.cluster_prefix + node_pools = var.autoscaler_nodepools }) # A concatenated list of all autoscaled nodes autoscaled_nodes = length(var.autoscaler_nodepools) == 0 ? {} : { diff --git a/kube.tf.example b/kube.tf.example index a84cc959..11fb25ea 100644 --- a/kube.tf.example +++ b/kube.tf.example @@ -367,7 +367,7 @@ module "kube-hetzner" { # - cluster_autoscaler_stderr_threshold: Sets the threshold for logs that go to stderr (--stderrthreshold). # # Server/node creation timeout variable: - # - cluster_autoscaler_server_creation_timeout: Sets the timeout (in minutes) until which a newly created server/node has to come available before giving up and destroying it (defaults to 5min) + # - cluster_autoscaler_server_creation_timeout: Sets the timeout (in minutes) until which a newly created server/node has to become available before giving up and destroying it (defaults to 15, unit is minutes) # # Example: # @@ -376,7 +376,7 @@ module "kube-hetzner" { # cluster_autoscaler_log_level = 4 # cluster_autoscaler_log_to_stderr = true # cluster_autoscaler_stderr_threshold = "INFO" - # cluster_autoscaler_server_creation_timeout = "5" + # cluster_autoscaler_server_creation_timeout = 15 # Additional Cluster Autoscaler binary configuration # diff --git a/variables.tf b/variables.tf index 3bb6bdcd..79c2c203 100644 --- a/variables.tf +++ b/variables.tf @@ -309,8 +309,9 @@ variable "cluster_autoscaler_extra_args" { } variable "cluster_autoscaler_server_creation_timeout" { - type = string - description = "Timeout (in minutes) until which a newly created server/node has to come available before giving up and destroying it (defaults to 5min)" + type = number + default = 15 + description = "Timeout (in minutes) until which a newly created server/node has to become available before giving up and destroying it." } variable "autoscaler_nodepools" { @@ -323,7 +324,7 @@ variable "autoscaler_nodepools" { max_nodes = number labels = optional(map(string), {}) kubelet_args = optional(list(string), ["kube-reserved=cpu=50m,memory=300Mi,ephemeral-storage=1Gi", "system-reserved=cpu=250m,memory=300Mi"]) - taints = optional(list(object({ + taints = optional(list(object({ key = string value = string effect = string