added a flag for the node names
This commit is contained in:
parent
b2d160f33a
commit
ae731a7746
@ -8,7 +8,7 @@ module "agents" {
|
|||||||
|
|
||||||
for_each = local.agent_nodepools
|
for_each = local.agent_nodepools
|
||||||
|
|
||||||
name = "${each.value.nodepool_name}-${random_pet.cluster.id}-${random_pet.agents[each.key].id}"
|
name = var.use_cluster_name_in_node_name ? "k3s-${random_pet.cluster.id}-${each.value.nodepool_name}-${random_pet.agents[each.key].id}" : "${each.value.nodepool_name}-${random_pet.agents[each.key].id}"
|
||||||
ssh_keys = [hcloud_ssh_key.k3s.id]
|
ssh_keys = [hcloud_ssh_key.k3s.id]
|
||||||
public_key = var.public_key
|
public_key = var.public_key
|
||||||
private_key = var.private_key
|
private_key = var.private_key
|
||||||
|
@ -6,9 +6,8 @@ resource "random_pet" "control_planes" {
|
|||||||
module "control_planes" {
|
module "control_planes" {
|
||||||
source = "./modules/host"
|
source = "./modules/host"
|
||||||
|
|
||||||
count = var.control_plane_count
|
count = var.control_plane_count
|
||||||
name = "control-plane-${random_pet.cluster.id}-${random_pet.control_planes[count.index].id}"
|
name = var.use_cluster_name_in_node_name ? "k3s-${random_pet.cluster.id}-control-plane-${random_pet.control_planes[count.index].id}" : "control-plane-${random_pet.control_planes[count.index].id}"
|
||||||
|
|
||||||
ssh_keys = [hcloud_ssh_key.k3s.id]
|
ssh_keys = [hcloud_ssh_key.k3s.id]
|
||||||
public_key = var.public_key
|
public_key = var.public_key
|
||||||
private_key = var.private_key
|
private_key = var.private_key
|
||||||
|
@ -9,7 +9,7 @@ spec:
|
|||||||
enabled: true
|
enabled: true
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
annotations:
|
annotations:
|
||||||
"load-balancer.hetzner.cloud/name": name
|
"load-balancer.hetzner.cloud/name": ${name}
|
||||||
# make hetzners load-balancer connect to our nodes via our private k3s
|
# make hetzners load-balancer connect to our nodes via our private k3s
|
||||||
"load-balancer.hetzner.cloud/use-private-ip": "true"
|
"load-balancer.hetzner.cloud/use-private-ip": "true"
|
||||||
# keep hetzner-ccm from exposing our private ingress ip, which in general isn't routeable from the public internet
|
# keep hetzner-ccm from exposing our private ingress ip, which in general isn't routeable from the public internet
|
||||||
|
@ -77,6 +77,9 @@ load_balancer_type = "lb11"
|
|||||||
# Allows you to specify either stable, latest, or testing (defaults to stable), see https://rancher.com/docs/k3s/latest/en/upgrades/basic/
|
# Allows you to specify either stable, latest, or testing (defaults to stable), see https://rancher.com/docs/k3s/latest/en/upgrades/basic/
|
||||||
# initial_k3s_channel = "latest"
|
# initial_k3s_channel = "latest"
|
||||||
|
|
||||||
|
# Whether to use the cluster name in the node name, i.e. add the prefix k3s-(cluster_name)- to the nodes? The default is "false".
|
||||||
|
# use_cluster_name_in_node_name = true
|
||||||
|
|
||||||
# Adding extra firewall rules, like opening a port
|
# Adding extra firewall rules, like opening a port
|
||||||
# In this example with allow port TCP 5432 for a Postgres service we will open via a nodeport
|
# In this example with allow port TCP 5432 for a Postgres service we will open via a nodeport
|
||||||
# More info on the format here https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/firewall
|
# More info on the format here https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/firewall
|
||||||
|
@ -120,3 +120,9 @@ variable "extra_firewall_rules" {
|
|||||||
default = []
|
default = []
|
||||||
description = "Additional firewall rules to apply to the cluster"
|
description = "Additional firewall rules to apply to the cluster"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "use_cluster_name_in_node_name" {
|
||||||
|
type = bool
|
||||||
|
default = false
|
||||||
|
description = "Whether to use the cluster name in the node name"
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user