From b46d35c8a54445bc2b6c8d74411e7887b7aecd8e Mon Sep 17 00:00:00 2001 From: Ruakij Date: Thu, 30 Mar 2023 14:54:28 +0200 Subject: [PATCH] Add labels --- kubernetes/templates/k3s/agent/config.yaml.jinja2 | 10 ++++++++++ kubernetes/templates/k3s/server/config.yaml.jinja2 | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/kubernetes/templates/k3s/agent/config.yaml.jinja2 b/kubernetes/templates/k3s/agent/config.yaml.jinja2 index 3900243..f42ec8e 100644 --- a/kubernetes/templates/k3s/agent/config.yaml.jinja2 +++ b/kubernetes/templates/k3s/agent/config.yaml.jinja2 @@ -9,3 +9,13 @@ kubelet-arg: "--node-ip=0.0.0.0" {% else %} node-ip: {{ nodeip_ipv4 }} {% endif %} + +## Label +# Region & DC +node-label: +{% if region is defined %} + - topology.kubernetes.io/region={{ region }} +{% endif %} +{% if zone is defined %} + - topology.kubernetes.io/zone={{ zone }} +{% endif %} diff --git a/kubernetes/templates/k3s/server/config.yaml.jinja2 b/kubernetes/templates/k3s/server/config.yaml.jinja2 index 8cea4fc..ba68c97 100644 --- a/kubernetes/templates/k3s/server/config.yaml.jinja2 +++ b/kubernetes/templates/k3s/server/config.yaml.jinja2 @@ -38,3 +38,14 @@ flannel-backend: none {% if kubernetes.ingress_controller != "traefik-ingress" %} disable: traefik {% endif %} + +## Label +# Region & DC +node-label: +{% if region is defined %} + - topology.kubernetes.io/region={{ region }} +{% endif %} +{% if zone is defined %} + - topology.kubernetes.io/zone={{ zone }} +{% endif %} +