From 0523a8907b838fab9436bb923265e540ec6c2c21 Mon Sep 17 00:00:00 2001 From: Vojtech Mares Date: Sat, 23 Nov 2024 09:35:03 +0100 Subject: [PATCH] refactor: remove old node pool and cleanup dns records --- CHANGELOG.md | 7 +++++++ dns.tf | 42 +----------------------------------------- machines.tf | 44 -------------------------------------------- 3 files changed, 8 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ec6e22..6cafadb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/dns.tf b/dns.tf index 01edec2..8197fe9 100644 --- a/dns.tf +++ b/dns.tf @@ -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,40 +40,10 @@ 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" value = cloudflare_record.ingress_cthulhu_k8s_vxm_cz.hostname type = "CNAME" proxied = false -} \ No newline at end of file +} diff --git a/machines.tf b/machines.tf index c6a56e6..c582b8f 100644 --- a/machines.tf +++ b/machines.tf @@ -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"