Fixed handling of install images

The default image was missing the qemu guest agent.
This commit is contained in:
Max Pfeiffer
2024-11-09 18:00:12 +01:00
parent 67ab2ce633
commit 0a410366ed
6 changed files with 16 additions and 4 deletions

View File

@@ -40,6 +40,8 @@ tofu apply
``` ```
## Information Sources ## Information Sources
* [Talos Linux documentation](https://www.talos.dev/v1.8/)
* [Talos Linux Image Factory](https://factory.talos.dev/)
* Terraform providers/modules * Terraform providers/modules
* [terraform-provider-proxmox](https://github.com/Telmate/terraform-provider-proxmox) * [terraform-provider-proxmox](https://github.com/Telmate/terraform-provider-proxmox)
* [terraform-provider-talos](https://github.com/siderolabs/terraform-provider-talos) * [terraform-provider-talos](https://github.com/siderolabs/terraform-provider-talos)

View File

@@ -1,5 +1,5 @@
resource "proxmox_storage_iso" "talos_linux_iso_image" { resource "proxmox_storage_iso" "talos_linux_iso_image" {
url = "https://factory.talos.dev/image/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515/v1.8.2/nocloud-amd64.iso" url = local.talos_linux_iso_image_url
filename = local.talos_linux_iso_image_filename filename = local.talos_linux_iso_image_filename
storage = "local" storage = "local"
pve_node = var.proxmox_target_node pve_node = var.proxmox_target_node

View File

@@ -2,7 +2,9 @@ locals {
repo_root = "${dirname(abspath(path.root))}" repo_root = "${dirname(abspath(path.root))}"
# Talos Linux # Talos Linux
talos_linux_iso_image_filename = "talos-linux-qemu-guest-agent-amd64.iso" talos_linux_iso_image_url = "https://factory.talos.dev/image/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515/v1.8.2/nocloud-amd64.iso"
talos_linux_iso_image_filename = "talos-linux-v1.8.2-qemu-guest-agent-amd64.iso"
talos_linux_image_reference = "factory.talos.dev/installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.8.2"
# K8s control plane # K8s control plane
k8s_control_plane_ip_address = "192.168.1.150" k8s_control_plane_ip_address = "192.168.1.150"

View File

@@ -27,9 +27,10 @@ resource "talos_machine_configuration_apply" "controlplane" {
for_each = var.node_data.controlplanes for_each = var.node_data.controlplanes
node = each.key node = each.key
config_patches = [ config_patches = [
templatefile("${path.module}/templates/machine_disk_and_hostname.yaml.tftmpl", { 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 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_disk = each.value.install_disk
install_image = each.value.install_image
}), }),
file("${path.module}/files/cp-scheduling.yaml"), file("${path.module}/files/cp-scheduling.yaml"),
] ]
@@ -42,9 +43,10 @@ resource "talos_machine_configuration_apply" "worker" {
for_each = var.node_data.workers for_each = var.node_data.workers
node = each.key node = each.key
config_patches = [ config_patches = [
templatefile("${path.module}/templates/machine_disk_and_hostname.yaml.tftmpl", { 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 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_disk = each.value.install_disk
install_image = each.value.install_image
}) })
] ]
} }

View File

@@ -1,5 +1,6 @@
machine: machine:
install: install:
disk: ${install_disk} disk: ${install_disk}
image: ${install_image}
network: network:
hostname: ${hostname} hostname: ${hostname}

View File

@@ -31,10 +31,12 @@ variable "node_data" {
type = object({ type = object({
controlplanes = map(object({ controlplanes = map(object({
install_disk = string install_disk = string
install_image = string
hostname = optional(string) hostname = optional(string)
})) }))
workers = map(object({ workers = map(object({
install_disk = string install_disk = string
install_image = string
hostname = optional(string) hostname = optional(string)
})) }))
}) })
@@ -42,14 +44,17 @@ variable "node_data" {
controlplanes = { controlplanes = {
"192.168.1.150" = { "192.168.1.150" = {
install_disk = "/dev/vda" install_disk = "/dev/vda"
install_image = "factory.talos.dev/installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.8.2"
}, },
} }
workers = { workers = {
"192.168.1.151" = { "192.168.1.151" = {
install_disk = "/dev/vda" install_disk = "/dev/vda"
install_image = "factory.talos.dev/installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.8.2"
}, },
"192.168.1.152" = { "192.168.1.152" = {
install_disk = "/dev/vda" install_disk = "/dev/vda"
install_image = "factory.talos.dev/installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.8.2"
} }
} }
} }