From 5115ca85390dd4867228c176883efeac4cf524ed Mon Sep 17 00:00:00 2001 From: Karim Naufal Date: Tue, 17 Oct 2023 03:55:49 +0200 Subject: [PATCH] renamed new terraform lb --- init.tf | 2 +- locals.tf | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/init.tf b/init.tf index 76c51fbe..f354788c 100644 --- a/init.tf +++ b/init.tf @@ -1,6 +1,6 @@ resource "hcloud_load_balancer" "cluster" { count = local.has_external_load_balancer ? 0 : 1 - name = var.cluster_name + name = local.load_balancer_name load_balancer_type = var.load_balancer_type location = var.load_balancer_location diff --git a/locals.tf b/locals.tf index ad2dc353..ce3b6fd2 100644 --- a/locals.tf +++ b/locals.tf @@ -101,7 +101,7 @@ locals { }) apply_k3s_selinux = ["/sbin/semodule -v -i /usr/share/selinux/packages/k3s.pp"] - swap_node_label = ["node.kubernetes.io/server-swap=enabled"] + swap_node_label = ["node.kubernetes.io/server-swap=enabled"] install_k3s_server = concat(local.common_pre_install_k3s_commands, [ "curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_SKIP_SELINUX_RPM=true INSTALL_K3S_CHANNEL=${var.initial_k3s_channel} INSTALL_K3S_EXEC='server ${var.k3s_exec_server_args}' sh -" @@ -120,7 +120,7 @@ locals { labels : concat(local.default_control_plane_labels, nodepool_obj.swap_size != "" ? local.swap_node_label : [], nodepool_obj.labels), taints : concat(local.default_control_plane_taints, nodepool_obj.taints), backups : nodepool_obj.backups, - swap_size: nodepool_obj.swap_size, + swap_size : nodepool_obj.swap_size, index : node_index } } @@ -138,7 +138,7 @@ locals { labels : concat(local.default_agent_labels, nodepool_obj.swap_size != "" ? local.swap_node_label : [], nodepool_obj.labels), taints : concat(local.default_agent_taints, nodepool_obj.taints), backups : lookup(nodepool_obj, "backups", false), - swap_size: nodepool_obj.swap_size, + swap_size : nodepool_obj.swap_size, index : node_index } } @@ -158,6 +158,7 @@ locals { using_klipper_lb = var.enable_klipper_metal_lb || local.is_single_node_cluster has_external_load_balancer = local.using_klipper_lb || local.ingress_controller == "none" + load_balancer_name = "${var.cluster_name}-${var.ingress_controller}" ingress_replica_count = (var.ingress_replica_count > 0) ? var.ingress_replica_count : (local.agent_count > 2) ? 3 : (local.agent_count == 2) ? 2 : 1 ingress_max_replica_count = (var.ingress_max_replica_count > local.ingress_replica_count) ? var.ingress_max_replica_count : local.ingress_replica_count @@ -455,7 +456,7 @@ controller: %{if !local.using_klipper_lb~} service: annotations: - "load-balancer.hetzner.cloud/name": "${var.cluster_name}" + "load-balancer.hetzner.cloud/name": "${local.load_balancer_name}" "load-balancer.hetzner.cloud/use-private-ip": "true" "load-balancer.hetzner.cloud/disable-private-ingress": "true" "load-balancer.hetzner.cloud/disable-public-network": "${var.load_balancer_disable_public_network}" @@ -482,7 +483,7 @@ service: type: LoadBalancer %{if !local.using_klipper_lb~} annotations: - "load-balancer.hetzner.cloud/name": "${var.cluster_name}" + "load-balancer.hetzner.cloud/name": "${local.load_balancer_name}" "load-balancer.hetzner.cloud/use-private-ip": "true" "load-balancer.hetzner.cloud/disable-private-ingress": "true" "load-balancer.hetzner.cloud/disable-public-network": "${var.load_balancer_disable_public_network}"