Updated talos version, made setup more configurable, removed obsolet stuff
This commit is contained in:
@@ -2,14 +2,14 @@ resource "talos_machine_secrets" "this" {}
|
||||
|
||||
data "talos_machine_configuration" "controlplane" {
|
||||
cluster_name = var.cluster_name
|
||||
cluster_endpoint = var.cluster_endpoint
|
||||
cluster_endpoint = "https://${var.vip_shared_ip}:6443"
|
||||
machine_type = "controlplane"
|
||||
machine_secrets = talos_machine_secrets.this.machine_secrets
|
||||
}
|
||||
|
||||
data "talos_machine_configuration" "worker" {
|
||||
cluster_name = var.cluster_name
|
||||
cluster_endpoint = var.cluster_endpoint
|
||||
cluster_endpoint = "https://${var.vip_shared_ip}:6443"
|
||||
machine_type = "worker"
|
||||
machine_secrets = talos_machine_secrets.this.machine_secrets
|
||||
}
|
||||
@@ -21,32 +21,38 @@ data "talos_client_configuration" "this" {
|
||||
}
|
||||
|
||||
resource "talos_machine_configuration_apply" "controlplane" {
|
||||
depends_on = [proxmox_vm_qemu.kubernetes_control_plane]
|
||||
depends_on = [proxmox_vm_qemu.kubernetes_control_plane]
|
||||
client_configuration = talos_machine_secrets.this.client_configuration
|
||||
machine_configuration_input = data.talos_machine_configuration.controlplane.machine_configuration
|
||||
for_each = var.node_data.controlplanes
|
||||
node = each.key
|
||||
config_patches = [
|
||||
templatefile("${path.module}/templates/machine_config_patches.tftpl", {
|
||||
hostname = each.value.hostname == null ? format("%s-cp-%s", var.cluster_name, index(keys(var.node_data.controlplanes), each.key)) : each.value.hostname
|
||||
install_disk = each.value.install_disk
|
||||
templatefile("${path.module}/templates/machine_config_patches_controlplane.tftpl", {
|
||||
hostname = each.value.hostname == null ? format("%s-cp-%s", var.cluster_name, index(keys(var.node_data.controlplanes), each.key)) : each.value.hostname
|
||||
install_disk = each.value.install_disk
|
||||
install_image = each.value.install_image
|
||||
ip_address = "${each.key}/24"
|
||||
network = var.network
|
||||
network_gateway = var.network_gateway
|
||||
vip_shared_ip = var.vip_shared_ip
|
||||
}),
|
||||
file("${path.module}/files/cp-scheduling.yaml"),
|
||||
]
|
||||
}
|
||||
|
||||
resource "talos_machine_configuration_apply" "worker" {
|
||||
depends_on = [proxmox_vm_qemu.kubernetes_worker]
|
||||
depends_on = [proxmox_vm_qemu.kubernetes_worker]
|
||||
client_configuration = talos_machine_secrets.this.client_configuration
|
||||
machine_configuration_input = data.talos_machine_configuration.worker.machine_configuration
|
||||
for_each = var.node_data.workers
|
||||
node = each.key
|
||||
config_patches = [
|
||||
templatefile("${path.module}/templates/machine_config_patches.tftpl", {
|
||||
hostname = each.value.hostname == null ? format("%s-worker-%s", var.cluster_name, index(keys(var.node_data.workers), each.key)) : each.value.hostname
|
||||
install_disk = each.value.install_disk
|
||||
templatefile("${path.module}/templates/machine_config_patches_worker.tftpl", {
|
||||
hostname = each.value.hostname == null ? format("%s-worker-%s", var.cluster_name, index(keys(var.node_data.workers), each.key)) : each.value.hostname
|
||||
install_disk = each.value.install_disk
|
||||
install_image = each.value.install_image
|
||||
ip_address = "${each.key}/24"
|
||||
network = var.network
|
||||
network_gateway = var.network_gateway
|
||||
})
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user