From b142be2d8416b372a759fb528b596f37ba984870 Mon Sep 17 00:00:00 2001 From: Henk van Maanen <36051232+HenkVanMaanen@users.noreply.github.com> Date: Mon, 11 Apr 2022 17:44:50 +0200 Subject: [PATCH] fix(control-plane): use correct taints and labels for first control plane node and fix existing default taints --- init.tf | 4 ++-- locals.tf | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/init.tf b/init.tf index 279f837..fd6ff68 100644 --- a/init.tf +++ b/init.tf @@ -18,8 +18,8 @@ resource "null_resource" "first_control_plane" { kubelet-arg = "cloud-provider=external" node-ip = module.control_planes[keys(module.control_planes)[0]].private_ipv4_address advertise-address = module.control_planes[keys(module.control_planes)[0]].private_ipv4_address - node-taint = var.allow_scheduling_on_control_plane ? [] : ["node-role.kubernetes.io/master:NoSchedule"] - node-label = var.automatically_upgrade_k3s ? ["k3s_upgrade=true"] : [] + node-taint = local.control_plane_nodepools[keys(module.control_planes)[0]].taints + node-label = local.control_plane_nodepools[keys(module.control_planes)[0]].labels }) destination = "/tmp/config.yaml" } diff --git a/locals.tf b/locals.tf index 42ef5ee..e3feeb0 100644 --- a/locals.tf +++ b/locals.tf @@ -177,7 +177,7 @@ locals { server_type : nodepool_obj.server_type, location : nodepool_obj.location, labels : concat(local.default_control_plane_labels, nodepool_obj.labels), - taints : nodepool_obj.taints, + taints : concat(local.default_control_plane_taints, nodepool_obj.taints), index : node_index } } @@ -209,5 +209,8 @@ locals { # Default k3s node labels default_agent_labels = concat([], var.automatically_upgrade_k3s ? ["k3s_upgrade=true"] : []) - default_control_plane_labels = concat([], var.allow_scheduling_on_control_plane ? [] : ["node-role.kubernetes.io/master:NoSchedule"]) + default_control_plane_labels = concat([], var.automatically_upgrade_k3s ? ["k3s_upgrade=true"] : []) + + # Default k3s node taints + default_control_plane_taints = concat([], var.allow_scheduling_on_control_plane ? [] : ["node-role.kubernetes.io/master:NoSchedule"]) }