Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoscaler: allow to set kubelet-arg for autoscaler nodes #1282

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion autoscaler-agents.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
locals {

Check failure on line 1 in autoscaler-agents.tf

View workflow job for this annotation

GitHub Actions / Check formatting of terraform files

File is not in canonical format (terraform fmt)
cluster_prefix = var.use_cluster_name_in_node_name ? "${var.cluster_name}-" : ""
first_nodepool_snapshot_id = length(var.autoscaler_nodepools) == 0 ? "" : (
substr(var.autoscaler_nodepools[0].server_type, 0, 3) == "cax" ? data.hcloud_image.microos_arm_snapshot.id : data.hcloud_image.microos_x86_snapshot.id
Expand Down Expand Up @@ -101,7 +101,7 @@
k3s_config = yamlencode({
server = "https://${var.use_control_plane_lb ? hcloud_load_balancer_network.control_plane.*.ip[0] : module.control_planes[keys(module.control_planes)[0]].private_ipv4_address}:6443"
token = local.k3s_token
kubelet-arg = local.kubelet_arg
kubelet-arg = concat(local.kubelet_arg, var.k3s_global_kubelet_args, var.k3s_autoscaler_kubelet_args, var.autoscaler_nodepools[count.index].kubelet_args)
flannel-iface = local.flannel_iface
node-label = concat(local.default_agent_labels, [for k, v in var.autoscaler_nodepools[count.index].labels : "${k}=${v}"])
node-taint = concat(local.default_agent_taints, [for taint in var.autoscaler_nodepools[count.index].taints : "${taint.key}=${taint.value}:${taint.effect}"])
Expand Down
2 changes: 2 additions & 0 deletions kube.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ module "kube-hetzner" {
# value: "peak-workloads"
# effect: "NoExecute"
# }]
# # kubelet_args = ["kube-reserved=cpu=250m,memory=1500Mi,ephemeral-storage=1Gi", "system-reserved=cpu=250m,memory=300Mi"]
# }
# ]

Expand Down Expand Up @@ -620,6 +621,7 @@ module "kube-hetzner" {
# k3s_global_kubelet_args = ["kube-reserved=cpu=100m,ephemeral-storage=1Gi", "system-reserved=cpu=memory=200Mi", "image-gc-high-threshold=50", "image-gc-low-threshold=40"]
# k3s_control_plane_kubelet_args = []
# k3s_agent_kubelet_args = []
# k3s_autoscaler_kubelet_args = []

# If you want to allow all outbound traffic you can set this to "false". Default is "true".
# restrict_outbound_traffic = false
Expand Down
21 changes: 14 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable "hcloud_token" {

Check failure on line 1 in variables.tf

View workflow job for this annotation

GitHub Actions / Check formatting of terraform files

File is not in canonical format (terraform fmt)
description = "Hetzner Cloud API Token."
type = string
sensitive = true
Expand Down Expand Up @@ -316,13 +316,14 @@
variable "autoscaler_nodepools" {
description = "Cluster autoscaler nodepools."
type = list(object({
name = string
server_type = string
location = string
min_nodes = number
max_nodes = number
labels = optional(map(string), {})
taints = optional(list(object({
name = string
server_type = string
location = string
min_nodes = number
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({
key = string
value = string
effect = string
Expand Down Expand Up @@ -952,6 +953,12 @@
description = "Kubelet args for agent nodes."
}

variable "k3s_autoscaler_kubelet_args" {
type = list(string)
default = []
description = "Kubelet args for autoscaler nodes."
}

variable "ingress_target_namespace" {
type = string
default = ""
Expand Down