placement group fix
This commit is contained in:
parent
6d33e69b69
commit
b17f1569f2
@ -9,7 +9,7 @@ module "agents" {
|
|||||||
private_key = var.private_key
|
private_key = var.private_key
|
||||||
additional_public_keys = var.additional_public_keys
|
additional_public_keys = var.additional_public_keys
|
||||||
firewall_ids = [hcloud_firewall.k3s.id]
|
firewall_ids = [hcloud_firewall.k3s.id]
|
||||||
placement_group_id = element(hcloud_placement_group.control_plane.*.id, ceil(each.value.index / 10))
|
placement_group_id = var.placement_group_disable ? 0 : element(hcloud_placement_group.agent.*.id, ceil(each.value.index / 10))
|
||||||
location = each.value.location
|
location = each.value.location
|
||||||
server_type = each.value.server_type
|
server_type = each.value.server_type
|
||||||
ipv4_subnet_id = hcloud_network_subnet.subnet[[for i, v in var.agent_nodepools : i if v.name == each.value.nodepool_name][0] + length(var.control_plane_nodepools) + 1].id
|
ipv4_subnet_id = hcloud_network_subnet.subnet[[for i, v in var.agent_nodepools : i if v.name == each.value.nodepool_name][0] + length(var.control_plane_nodepools) + 1].id
|
||||||
|
@ -9,7 +9,7 @@ module "control_planes" {
|
|||||||
private_key = var.private_key
|
private_key = var.private_key
|
||||||
additional_public_keys = var.additional_public_keys
|
additional_public_keys = var.additional_public_keys
|
||||||
firewall_ids = [hcloud_firewall.k3s.id]
|
firewall_ids = [hcloud_firewall.k3s.id]
|
||||||
placement_group_id = element(hcloud_placement_group.control_plane.*.id, ceil(each.value.index / 10))
|
placement_group_id = var.placement_group_disable ? 0 : element(hcloud_placement_group.control_plane.*.id, ceil(each.value.index / 10))
|
||||||
location = each.value.location
|
location = each.value.location
|
||||||
server_type = each.value.server_type
|
server_type = each.value.server_type
|
||||||
ipv4_subnet_id = hcloud_network_subnet.subnet[[for i, v in var.control_plane_nodepools : i if v.name == each.value.nodepool_name][0] + 1].id
|
ipv4_subnet_id = hcloud_network_subnet.subnet[[for i, v in var.control_plane_nodepools : i if v.name == each.value.nodepool_name][0] + 1].id
|
||||||
|
7
main.tf
7
main.tf
@ -38,13 +38,13 @@ resource "hcloud_firewall" "k3s" {
|
|||||||
|
|
||||||
resource "hcloud_placement_group" "control_plane" {
|
resource "hcloud_placement_group" "control_plane" {
|
||||||
count = ceil(local.control_plane_count / 10)
|
count = ceil(local.control_plane_count / 10)
|
||||||
name = "${var.cluster_name}-${count.index + 1}"
|
name = "${var.cluster_name}-control-plane-${count.index + 1}"
|
||||||
type = "spread"
|
type = "spread"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "hcloud_placement_group" "agent" {
|
resource "hcloud_placement_group" "agent" {
|
||||||
count = ceil(local.agent_count / 10)
|
count = ceil(local.agent_count / 10)
|
||||||
name = "${var.cluster_name}-${count.index + 1}"
|
name = "${var.cluster_name}-agent-${count.index + 1}"
|
||||||
type = "spread"
|
type = "spread"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,9 +74,10 @@ resource "null_resource" "destroy_traefik_loadbalancer" {
|
|||||||
local_sensitive_file.kubeconfig,
|
local_sensitive_file.kubeconfig,
|
||||||
null_resource.control_planes[0],
|
null_resource.control_planes[0],
|
||||||
hcloud_network_subnet.subnet,
|
hcloud_network_subnet.subnet,
|
||||||
|
hcloud_placement_group.control_plane,
|
||||||
|
hcloud_placement_group.agent,
|
||||||
hcloud_network.k3s,
|
hcloud_network.k3s,
|
||||||
hcloud_firewall.k3s,
|
hcloud_firewall.k3s,
|
||||||
hcloud_placement_group.k3s,
|
|
||||||
hcloud_ssh_key.k3s
|
hcloud_ssh_key.k3s
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -84,9 +84,8 @@ agent_nodepools = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
# That will depend on how much load you want it to handle, see https://www.hetzner.com/cloud/load-balancer
|
# LB location and type, the latter will depend on how much load you want it to handle, see https://www.hetzner.com/cloud/load-balancer
|
||||||
load_balancer_type = "lb11"
|
load_balancer_type = "lb11"
|
||||||
|
|
||||||
load_balancer_location = "fsn1"
|
load_balancer_location = "fsn1"
|
||||||
|
|
||||||
### The following values are fully optional
|
### The following values are fully optional
|
||||||
@ -147,3 +146,7 @@ load_balancer_location = "fsn1"
|
|||||||
# If you want to configure additional Arguments for traefik, enter them here as a list and in the form of traefik CLI arguments; see https://doc.traefik.io/traefik/reference/static-configuration/cli/
|
# If you want to configure additional Arguments for traefik, enter them here as a list and in the form of traefik CLI arguments; see https://doc.traefik.io/traefik/reference/static-configuration/cli/
|
||||||
# Example: traefik_additional_options = ["--log.level=DEBUG", "--tracing=true"]
|
# Example: traefik_additional_options = ["--log.level=DEBUG", "--tracing=true"]
|
||||||
# traefik_additional_options = []
|
# traefik_additional_options = []
|
||||||
|
|
||||||
|
# If you want to disable the automatic use of placement group "spread". See https://docs.hetzner.com/cloud/placement-groups/overview/
|
||||||
|
# That may be useful if you need to deploy more than 500 nodes! The default is "false".
|
||||||
|
# placement_group_disable = true
|
||||||
|
@ -138,5 +138,10 @@ variable "cluster_name" {
|
|||||||
variable "traefik_additional_options" {
|
variable "traefik_additional_options" {
|
||||||
type = list(string)
|
type = list(string)
|
||||||
default = []
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "placement_group_disable" {
|
||||||
|
type = bool
|
||||||
|
default = false
|
||||||
|
description = "Whether to disable placement groups"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user