refactor(talos): condensate machine config into two files

Signed-off-by: Vegard Hagen <[email protected]>
This commit is contained in:
Vegard Hagen
2025-03-23 12:38:47 +01:00
parent 47142aad99
commit 83e1c95b06
6 changed files with 47 additions and 68 deletions
+6 -16
View File
@@ -24,28 +24,18 @@ data "talos_machine_configuration" "this" {
templatefile("${path.module}/machine-config/common.yaml.tftpl", {
node_name = each.value.host_node
cluster_name = var.cluster.proxmox_cluster
})
, each.value.machine_type == "controlplane" ?
templatefile("${path.module}/machine-config/control-plane.yaml.tftpl", {
cilium_values = var.cilium.values
cilium_install = var.cilium.install
base_domain = var.cluster.base_domain
}) : ""
, (each.value.machine_type == "controlplane" && var.cluster.vip != null)
? templatefile("${path.module}/machine-config/network-vip.yaml.tftpl", {
hostname = each.key
ip = each.value.ip
mac_address = lower(each.value.mac_address)
gateway = var.cluster.gateway
subnet_mask = var.cluster.subnet_mask
vip = var.cluster.vip
}) : templatefile("${path.module}/machine-config/network-no-vip.yaml.tftpl", {
hostname = each.key
ip = each.value.ip
mac_address = lower(each.value.mac_address)
gateway = var.cluster.gateway
subnet_mask = var.cluster.subnet_mask
})
}), each.value.machine_type == "controlplane" ?
templatefile("${path.module}/machine-config/control-plane.yaml.tftpl", {
cilium_values = var.cilium.values
cilium_install = var.cilium.install
base_domain = var.cluster.base_domain
}) : ""
]
}
@@ -1,4 +1,22 @@
machine:
nodeLabels:
topology.kubernetes.io/region: ${cluster_name}
topology.kubernetes.io/zone: ${node_name}
network:
hostname: ${hostname}
interfaces:
- deviceSelector:
hardwareAddr: ${mac_address}
addresses:
- ${ip}/${subnet_mask}
routes:
- network: 0.0.0.0/0
gateway: ${gateway}
dhcp: false
%{ if vip != null }
vip:
ip: ${vip}
%{ endif }
sysctls:
fs.inotify.max_user_watches: 1048576 # Watchdog
fs.inotify.max_user_instances: 8192 # Watchdog
@@ -12,6 +30,3 @@ machine:
net.ipv4.tcp_wmem: 4096 65536 33554432 # 10Gb/s
net.ipv4.tcp_window_scaling: 1 # 10Gb/s
vm.nr_hugepages: 1024 # PostgreSQL
nodeLabels:
topology.kubernetes.io/region: ${cluster_name}
topology.kubernetes.io/zone: ${node_name}
@@ -1,12 +0,0 @@
machine:
network:
hostname: ${hostname}
interfaces:
- deviceSelector:
hardwareAddr: ${mac_address}
addresses:
- ${ip}/${subnet_mask}
routes:
- network: 0.0.0.0/0
gateway: ${gateway}
dhcp: false
@@ -1,14 +0,0 @@
machine:
network:
hostname: ${hostname}
interfaces:
- deviceSelector:
hardwareAddr: ${mac_address}
addresses:
- ${ip}/${subnet_mask}
routes:
- network: 0.0.0.0/0
gateway: ${gateway}
dhcp: false
vip:
ip: ${vip}