From dcc6024af6524c82dfd68ffcf27271b915687208 Mon Sep 17 00:00:00 2001 From: pgijsbertsen <117165507+pgijsbertsen@users.noreply.github.com> Date: Fri, 31 Oct 2025 17:24:40 +0100 Subject: [PATCH] feat: Manage VM identifiers --- .../k8s-wheatley/.terraform.lock.hcl | 18 ------------------ pve01.wheatley.in/k8s-wheatley/main.tf | 10 +++------- .../templates/machineconfig-cp.yaml.tmpl | 1 + .../templates/machineconfig-worker.yaml.tmpl | 1 + .../k8s-wheatley/modules/talos-node/main.tf | 1 + .../modules/talos-node/variables.tf | 1 + pve01.wheatley.in/k8s-wheatley/providers.tf | 4 ---- 7 files changed, 7 insertions(+), 29 deletions(-) diff --git a/pve01.wheatley.in/k8s-wheatley/.terraform.lock.hcl b/pve01.wheatley.in/k8s-wheatley/.terraform.lock.hcl index f7b0924..8b2a866 100644 --- a/pve01.wheatley.in/k8s-wheatley/.terraform.lock.hcl +++ b/pve01.wheatley.in/k8s-wheatley/.terraform.lock.hcl @@ -41,24 +41,6 @@ provider "registry.opentofu.org/hashicorp/http" { ] } -provider "registry.opentofu.org/hashicorp/time" { - version = "0.11.1" - constraints = "0.11.1" - hashes = [ - "h1:+S9YvR/HeCxFGMS3ITjOFqlWrR6DdarWWowT9Cz18/M=", - "zh:048c56f9f810f67a7460363a26bf3ef939d64f0d7b7342b9e7f24cc85ee1491b", - "zh:49f949cc5cb50fbb65f7b4578b79fbe02b6bafe9e3f5f1c2936114dd445b84b3", - "zh:553174a4fa88f6e186800d7ee155a6b5b4c6c81793643f1a20eab26becc7f823", - "zh:5cae304e21f77091d4b50389c655afd5e4e2e8d4cd9c06de139a31b8e7d343a9", - "zh:7aae20832bd9885f034831aa44db3a6ffcec034a2d5a2815d92c42c40c14ca1d", - "zh:93d715610dce777474b5eff1d7dbe797e72ca0b679cd8636efb3aa45d1cb589e", - "zh:bd29e04645775851eb10e7f3b39104ae57ca3632dec4ae07328d33d4182e7fb5", - "zh:d6ad6a4d52a6989b8452466f2ec3dbcdb00cc44a96bd1ca618d91a5d74895f49", - "zh:e68cfad3ec526631410fa9406938d624fd56b9ab065c76525cb3f731d106fbfe", - "zh:ffee8aa6b7ce56f4b8fdc0c492404be0041137a278388eb1d1180b637fb5b3de", - ] -} - provider "registry.opentofu.org/siderolabs/talos" { version = "0.9.0" constraints = "0.9.0" diff --git a/pve01.wheatley.in/k8s-wheatley/main.tf b/pve01.wheatley.in/k8s-wheatley/main.tf index a4bb367..b7ef3a4 100644 --- a/pve01.wheatley.in/k8s-wheatley/main.tf +++ b/pve01.wheatley.in/k8s-wheatley/main.tf @@ -95,6 +95,7 @@ module "controlplanes" { for_each = { for node in local.controlplanes.nodes : node.name => node } node = { + id = 100 + tonumber(replace(each.key, "cp", "")) name = format("k8s-wheatley-%s", each.value.name) ipv4_address = each.value.ip_address cpu = local.controlplanes.cpu @@ -112,19 +113,14 @@ module "controlplanes" { } } -resource "time_sleep" "delay_before_workers" { - depends_on = [module.talos-image] - - create_duration = "1s" -} - module "workers" { - depends_on = [time_sleep.delay_before_workers] + depends_on = [module.talos-image] source = "./modules/talos-node" for_each = { for node in local.workers.nodes : node.name => node } node = { + id = 110 + tonumber(replace(each.key, "worker", "")) name = format("k8s-wheatley-%s", each.value.name) ipv4_address = each.value.ip_address cpu = local.workers.cpu diff --git a/pve01.wheatley.in/k8s-wheatley/modules/talos-bootstrap/templates/machineconfig-cp.yaml.tmpl b/pve01.wheatley.in/k8s-wheatley/modules/talos-bootstrap/templates/machineconfig-cp.yaml.tmpl index 3eeedc6..052c621 100644 --- a/pve01.wheatley.in/k8s-wheatley/modules/talos-bootstrap/templates/machineconfig-cp.yaml.tmpl +++ b/pve01.wheatley.in/k8s-wheatley/modules/talos-bootstrap/templates/machineconfig-cp.yaml.tmpl @@ -38,6 +38,7 @@ cluster: disabled: true extraManifests: - https://github.com/kubernetes-sigs/gateway-api/releases/download/v${gateway-api_version}/standard-install.yaml + - https://raw.githubusercontent.com/alex1989hu/kubelet-serving-cert-approver/main/deploy/standalone-install.yaml inlineManifests: - name: cilium-bootstrap contents: | diff --git a/pve01.wheatley.in/k8s-wheatley/modules/talos-bootstrap/templates/machineconfig-worker.yaml.tmpl b/pve01.wheatley.in/k8s-wheatley/modules/talos-bootstrap/templates/machineconfig-worker.yaml.tmpl index 28a35db..423f1f5 100644 --- a/pve01.wheatley.in/k8s-wheatley/modules/talos-bootstrap/templates/machineconfig-worker.yaml.tmpl +++ b/pve01.wheatley.in/k8s-wheatley/modules/talos-bootstrap/templates/machineconfig-worker.yaml.tmpl @@ -33,6 +33,7 @@ cluster: disabled: true extraManifests: - https://github.com/kubernetes-sigs/gateway-api/releases/download/v${gateway-api_version}/standard-install.yaml + - https://raw.githubusercontent.com/alex1989hu/kubelet-serving-cert-approver/main/deploy/standalone-install.yaml inlineManifests: - name: cilium-bootstrap contents: | diff --git a/pve01.wheatley.in/k8s-wheatley/modules/talos-node/main.tf b/pve01.wheatley.in/k8s-wheatley/modules/talos-node/main.tf index d904d43..3d07db2 100644 --- a/pve01.wheatley.in/k8s-wheatley/modules/talos-node/main.tf +++ b/pve01.wheatley.in/k8s-wheatley/modules/talos-node/main.tf @@ -8,6 +8,7 @@ terraform { } resource "proxmox_virtual_environment_vm" "talos-node" { + vm_id = var.node.id name = var.node.name node_name = var.node.proxmox_node tags = ["tofu"] diff --git a/pve01.wheatley.in/k8s-wheatley/modules/talos-node/variables.tf b/pve01.wheatley.in/k8s-wheatley/modules/talos-node/variables.tf index 99350b6..d1bfea6 100644 --- a/pve01.wheatley.in/k8s-wheatley/modules/talos-node/variables.tf +++ b/pve01.wheatley.in/k8s-wheatley/modules/talos-node/variables.tf @@ -1,6 +1,7 @@ variable "node" { description = "Virtual node configuration" type = object({ + id = number name = string ipv4_address = string ipv4_gateway = string diff --git a/pve01.wheatley.in/k8s-wheatley/providers.tf b/pve01.wheatley.in/k8s-wheatley/providers.tf index 577a604..240a9d3 100644 --- a/pve01.wheatley.in/k8s-wheatley/providers.tf +++ b/pve01.wheatley.in/k8s-wheatley/providers.tf @@ -8,9 +8,5 @@ terraform { source = "bpg/proxmox" version = "0.85.1" } - time = { - source = "hashicorp/time" - version = "0.11.1" - } } }