diff --git a/agents.tf b/agents.tf index 99927976..b23d87e2 100644 --- a/agents.tf +++ b/agents.tf @@ -17,7 +17,7 @@ module "agents" { location = each.value.location server_type = each.value.server_type ipv4_subnet_id = hcloud_network_subnet.agent[[for i, v in var.agent_nodepools : i if v.name == each.value.nodepool_name][0]].id - packages_to_install = concat(var.enable_longhorn ? ["open-iscsi", "nfs-client"] : [], []) + packages_to_install = local.packages_to_install private_ipv4 = cidrhost(hcloud_network_subnet.agent[[for i, v in var.agent_nodepools : i if v.name == each.value.nodepool_name][0]].ip_range, each.value.index + 101) diff --git a/control_planes.tf b/control_planes.tf index 3fcf9bd9..b4379899 100644 --- a/control_planes.tf +++ b/control_planes.tf @@ -17,7 +17,7 @@ module "control_planes" { location = each.value.location server_type = each.value.server_type ipv4_subnet_id = hcloud_network_subnet.control_plane[[for i, v in var.control_plane_nodepools : i if v.name == each.value.nodepool_name][0]].id - packages_to_install = concat(var.enable_longhorn ? ["open-iscsi", "nfs-client"] : [], []) + packages_to_install = local.packages_to_install # We leave some room so 100 eventual Hetzner LBs that can be created perfectly safely # It leaves the subnet with 254 x 254 - 100 = 64416 IPs to use, so probably enough. diff --git a/locals.tf b/locals.tf index 48b8380f..17477592 100644 --- a/locals.tf +++ b/locals.tf @@ -84,6 +84,8 @@ locals { # Default k3s node taints default_control_plane_taints = concat([], local.allow_scheduling_on_control_plane ? [] : ["node-role.kubernetes.io/master:NoSchedule"]) + packages_to_install = concat(var.enable_longhorn ? ["open-iscsi", "nfs-client"] : [], []) + # The following IPs are important to be whitelisted because they communicate with Hetzner services and enable the CCM and CSI to work properly. # Source https://github.com/hetznercloud/csi-driver/issues/204#issuecomment-848625566 hetzner_metadata_service_ipv4 = "169.254.169.254/32"