refactor: remove old node pool and cleanup dns records
This commit is contained in:
parent
b8b0a7ce22
commit
0523a8907b
3 changed files with 8 additions and 85 deletions
|
|
@ -1,5 +1,12 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.8.0] - 2024-11-23
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Remove old node pool
|
||||||
|
- Clean up DNS records for machines
|
||||||
|
|
||||||
## [0.7.0] - 2024-11-23
|
## [0.7.0] - 2024-11-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
42
dns.tf
42
dns.tf
|
|
@ -30,16 +30,6 @@ resource "cloudflare_record" "cthulhu_control_plane" {
|
||||||
proxied = false
|
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" {
|
resource "cloudflare_record" "cthulhu_kubeapi_singlenode" {
|
||||||
count = length(hcloud_server.cthulhu_control_plane) == 1 ? 1 : 0
|
count = length(hcloud_server.cthulhu_control_plane) == 1 ? 1 : 0
|
||||||
|
|
||||||
|
|
@ -50,40 +40,10 @@ resource "cloudflare_record" "cthulhu_kubeapi_singlenode" {
|
||||||
proxied = false
|
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" {
|
resource "cloudflare_record" "cthulhu_wildcard" {
|
||||||
zone_id = data.cloudflare_zone.vxm_cz.id
|
zone_id = data.cloudflare_zone.vxm_cz.id
|
||||||
name = "*.cthulhu.k8s"
|
name = "*.cthulhu.k8s"
|
||||||
value = cloudflare_record.ingress_cthulhu_k8s_vxm_cz.hostname
|
value = cloudflare_record.ingress_cthulhu_k8s_vxm_cz.hostname
|
||||||
type = "CNAME"
|
type = "CNAME"
|
||||||
proxied = false
|
proxied = false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
44
machines.tf
44
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" {
|
module "workers_v2" {
|
||||||
source = "./modules/node-pool/v1"
|
source = "./modules/node-pool/v1"
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue