diff --git a/kubernetes/helm.tf b/kubernetes/helm.tf deleted file mode 100644 index 0e9a79e..0000000 --- a/kubernetes/helm.tf +++ /dev/null @@ -1,8 +0,0 @@ -resource "helm_release" "argocd" { - name = "argocd" - chart = "argo-cd" - repository = "https://argoproj.github.io/argo-helm" - version = "7.7.0" - timeout = "1500" - namespace = kubernetes_namespace.argocd.id -} \ No newline at end of file diff --git a/kubernetes/namespaces.tf b/kubernetes/namespaces.tf index c78e14c..a4e66ed 100644 --- a/kubernetes/namespaces.tf +++ b/kubernetes/namespaces.tf @@ -1,3 +1,9 @@ +resource "kubernetes_namespace" "ingress" { + metadata { + name = "ingress" + } +} + resource "kubernetes_namespace" "argocd" { metadata { name = "argocd" diff --git a/proxmox/talos_linux.tf b/proxmox/talos_linux.tf index 00d2b6b..de6b076 100644 --- a/proxmox/talos_linux.tf +++ b/proxmox/talos_linux.tf @@ -21,7 +21,7 @@ data "talos_client_configuration" "this" { } resource "talos_machine_configuration_apply" "controlplane" { - depends_on = [proxmox_vm_qemu.k8s_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 @@ -37,7 +37,7 @@ resource "talos_machine_configuration_apply" "controlplane" { } resource "talos_machine_configuration_apply" "worker" { - depends_on = [proxmox_vm_qemu.k8s_worker_1, proxmox_vm_qemu.k8s_worker_2] + 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 diff --git a/proxmox/virtual_machines.tf b/proxmox/virtual_machines.tf index aeacae7..915626c 100644 --- a/proxmox/virtual_machines.tf +++ b/proxmox/virtual_machines.tf @@ -1,7 +1,8 @@ -resource "proxmox_vm_qemu" "k8s_control_plane" { +resource "proxmox_vm_qemu" "kubernetes_control_plane" { depends_on = [proxmox_storage_iso.talos_linux_iso_image] - name = "k8s-control-plane" - desc = "Control Node" + for_each = var.node_data.controlplanes + name = format("kubernetes-control-plane-%s", index(keys(var.node_data.controlplanes), each.key)) + desc = "Kubernetes Control Plane" target_node = var.proxmox_target_node agent = 1 vm_state = "running" @@ -40,14 +41,15 @@ resource "proxmox_vm_qemu" "k8s_control_plane" { # Cloud init setup os_type = "cloud-init" - ipconfig0 = "ip=${local.k8s_control_plane_ip_address}/24,gw=192.168.1.1" + ipconfig0 = "ip=${each.key}/24,gw=192.168.1.1" } -resource "proxmox_vm_qemu" "k8s_worker_1" { +resource "proxmox_vm_qemu" "kubernetes_worker" { depends_on = [proxmox_storage_iso.talos_linux_iso_image] - name = "k8s-worker-1" - desc = "Worker Node 1" + for_each = var.node_data.workers + name = format("kubernetes-worker-%s", index(keys(var.node_data.workers), each.key)) + desc = "Kubernetes Worker Node" target_node = var.proxmox_target_node agent = 1 vm_state = "running" @@ -86,51 +88,5 @@ resource "proxmox_vm_qemu" "k8s_worker_1" { # Cloud init setup os_type = "cloud-init" - ipconfig0 = "ip=${local.k8s_worker_1_ip_address}/24,gw=192.168.1.1" -} - - -resource "proxmox_vm_qemu" "k8s_worker_2" { - depends_on = [proxmox_storage_iso.talos_linux_iso_image] - name = "k8s-worker-2" - desc = "Worker Node 2" - target_node = var.proxmox_target_node - agent = 1 - vm_state = "running" - cores = 2 - memory = 8192 - boot = "order=virtio0;ide2" - - vga { - type = "std" - } - - disk { - slot = "ide0" - type = "cloudinit" - storage = "local-lvm" - } - - disk { - slot = "ide2" - type = "cdrom" - iso = "local:iso/${local.talos_linux_iso_image_filename}" - } - - disk { - slot = "virtio0" - type = "disk" - storage = "local-lvm" - size = "10240M" - discard = true - } - - network { - model = "virtio" - bridge = "vmbr0" - } - - # Cloud init setup - os_type = "cloud-init" - ipconfig0 = "ip=${local.k8s_worker_2_ip_address}/24,gw=192.168.1.1" + ipconfig0 = "ip=${each.key}/24,gw=192.168.1.1" }