diff --git a/aws/container-linux/kubernetes/variables.tf b/aws/container-linux/kubernetes/variables.tf index 7005e63b6..14621fda4 100644 --- a/aws/container-linux/kubernetes/variables.tf +++ b/aws/container-linux/kubernetes/variables.tf @@ -154,3 +154,9 @@ variable "enable_aggregation" { default = "false" } +variable "node_labels" { + description = "List of additional labels to add to worker nodes" + type = list + default = [] +} + diff --git a/aws/container-linux/kubernetes/workers.tf b/aws/container-linux/kubernetes/workers.tf index b5df22138..ef17f736f 100644 --- a/aws/container-linux/kubernetes/workers.tf +++ b/aws/container-linux/kubernetes/workers.tf @@ -19,5 +19,6 @@ module "workers" { service_cidr = var.service_cidr cluster_domain_suffix = var.cluster_domain_suffix clc_snippets = var.worker_clc_snippets + node_labels = var.node_labels } diff --git a/aws/container-linux/kubernetes/workers/cl/worker.yaml.tmpl b/aws/container-linux/kubernetes/workers/cl/worker.yaml.tmpl index a54411410..a98376236 100644 --- a/aws/container-linux/kubernetes/workers/cl/worker.yaml.tmpl +++ b/aws/container-linux/kubernetes/workers/cl/worker.yaml.tmpl @@ -61,6 +61,9 @@ systemd: --lock-file=/var/run/lock/kubelet.lock \ --network-plugin=cni \ --node-labels=node.kubernetes.io/node \ + %{ for label in split(";", node_labels) } + --node-labels=${label} \ + %{ endfor ~} --pod-manifest-path=/etc/kubernetes/manifests \ --read-only-port=0 \ --volume-plugin-dir=/var/lib/kubelet/volumeplugins diff --git a/aws/container-linux/kubernetes/workers/variables.tf b/aws/container-linux/kubernetes/workers/variables.tf index e5c5b6082..830a480cd 100644 --- a/aws/container-linux/kubernetes/workers/variables.tf +++ b/aws/container-linux/kubernetes/workers/variables.tf @@ -105,3 +105,8 @@ variable "cluster_domain_suffix" { default = "cluster.local" } +variable "node_labels" { + description = "List of additional labels to add to worker nodes" + type = list + default = [] +} diff --git a/aws/container-linux/kubernetes/workers/workers.tf b/aws/container-linux/kubernetes/workers/workers.tf index 5effb7890..37ba5bdfc 100644 --- a/aws/container-linux/kubernetes/workers/workers.tf +++ b/aws/container-linux/kubernetes/workers/workers.tf @@ -86,6 +86,7 @@ data "template_file" "worker-config" { cluster_dns_service_ip = cidrhost(var.service_cidr, 10) cluster_domain_suffix = var.cluster_domain_suffix cgroup_driver = local.flavor == "flatcar" && local.channel == "edge" ? "systemd" : "cgroupfs" + node_labels = join(";", var.node_labels) } }