1
0
Fork 0

refactor: remove old node pool and cleanup dns records

This commit is contained in:
Vojtěch Mareš 2024-11-23 09:35:03 +01:00
parent b8b0a7ce22
commit 0523a8907b
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D
3 changed files with 8 additions and 85 deletions

View file

@ -1,5 +1,12 @@
# Changelog
## [0.8.0] - 2024-11-23
### Removed
- Remove old node pool
- Clean up DNS records for machines
## [0.7.0] - 2024-11-23
### Added

40
dns.tf
View file

@ -30,16 +30,6 @@ resource "cloudflare_record" "cthulhu_control_plane" {
proxied = false
}
resource "cloudflare_record" "cthulhu_control_plane_ipv6" {
count = length(hcloud_server.cthulhu_control_plane)
zone_id = data.cloudflare_zone.vxm_cz.id
name = "control-plane-${count.index}.cthulhu.k8s"
value = hcloud_server.cthulhu_control_plane[count.index].ipv6_address
type = "AAAA"
proxied = false
}
resource "cloudflare_record" "cthulhu_kubeapi_singlenode" {
count = length(hcloud_server.cthulhu_control_plane) == 1 ? 1 : 0
@ -50,36 +40,6 @@ resource "cloudflare_record" "cthulhu_kubeapi_singlenode" {
proxied = false
}
resource "cloudflare_record" "cthulhu_kubeapi_singlenode_ipv6" {
count = length(hcloud_server.cthulhu_control_plane) == 1 ? 1 : 0
zone_id = data.cloudflare_zone.vxm_cz.id
name = "api.cthulhu.k8s"
value = hcloud_server.cthulhu_control_plane[0].ipv6_address
type = "AAAA"
proxied = false
}
resource "cloudflare_record" "cthulhu_workers" {
count = length(hcloud_server.cthulhu_workers)
zone_id = data.cloudflare_zone.vxm_cz.id
name = "worker-${random_string.workers_suffix.result}-${count.index}.cthulhu.k8s"
value = hcloud_server.cthulhu_workers[count.index].ipv4_address
type = "A"
proxied = false
}
resource "cloudflare_record" "cthulhu_workers_ipv6" {
count = length(hcloud_server.cthulhu_workers)
zone_id = data.cloudflare_zone.vxm_cz.id
name = "worker-${random_string.workers_suffix.result}-${count.index}.cthulhu.k8s"
value = hcloud_server.cthulhu_workers[count.index].ipv6_address
type = "AAAA"
proxied = false
}
resource "cloudflare_record" "cthulhu_wildcard" {
zone_id = data.cloudflare_zone.vxm_cz.id
name = "*.cthulhu.k8s"

View file

@ -51,50 +51,6 @@ resource "hcloud_server" "cthulhu_control_plane" {
}
}
resource "random_string" "workers_suffix" {
length = 4
special = false
upper = false
}
resource "hcloud_server" "cthulhu_workers" {
count = 3
name = "worker-${random_string.workers_suffix.result}-${count.index}"
image = "rocky-9"
server_type = "cax21"
location = "fsn1"
backups = false
shutdown_before_deletion = true
placement_group_id = hcloud_placement_group.cthulhu_workers.id
# firewall_ids = [
# hcloud_firewall.cthulhu_nodes_public.id,
# hcloud_firewall.cthulhu_nodes_private.id,
# ]
ssh_keys = [data.hcloud_ssh_key.vojtechmares.id]
labels = {
"k8s.node.role" = "worker"
"k8s.node.name" = "worker-${random_string.workers_suffix.result}-${count.index}"
"k8s.cluster.name" = "cthulhu"
"k8s.node.pool" = random_string.workers_suffix.result
}
public_net {
ipv4_enabled = true
ipv6_enabled = true
}
network {
network_id = hcloud_network.cthulhu.id
ip = cidrhost(hcloud_network_subnet.workers.ip_range, count.index + 1)
}
}
module "workers_v2" {
source = "./modules/node-pool/v1"