feat: Manage VM identifiers
This commit is contained in:
parent
66c61fafc9
commit
2aa47a54d1
7 changed files with 8 additions and 29 deletions
18
pve01.wheatley.in/k8s-wheatley/.terraform.lock.hcl
generated
18
pve01.wheatley.in/k8s-wheatley/.terraform.lock.hcl
generated
|
|
@ -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" {
|
provider "registry.opentofu.org/siderolabs/talos" {
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
constraints = "0.9.0"
|
constraints = "0.9.0"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ provider "proxmox" {
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
cluster_name = "k8s-wheatley"
|
cluster_name = "k8s-wheatley"
|
||||||
|
vm-id_prefix = 200
|
||||||
kubernetes_version = "1.34.1"
|
kubernetes_version = "1.34.1"
|
||||||
talos_version = "1.11.3"
|
talos_version = "1.11.3"
|
||||||
gateway_api_version = "1.4.0"
|
gateway_api_version = "1.4.0"
|
||||||
|
|
@ -95,6 +96,7 @@ module "controlplanes" {
|
||||||
for_each = { for node in local.controlplanes.nodes : node.name => node }
|
for_each = { for node in local.controlplanes.nodes : node.name => node }
|
||||||
|
|
||||||
node = {
|
node = {
|
||||||
|
id = local.vm-id_prefix + 10 + tonumber(replace(each.key, "cp", ""))
|
||||||
name = format("k8s-wheatley-%s", each.value.name)
|
name = format("k8s-wheatley-%s", each.value.name)
|
||||||
ipv4_address = each.value.ip_address
|
ipv4_address = each.value.ip_address
|
||||||
cpu = local.controlplanes.cpu
|
cpu = local.controlplanes.cpu
|
||||||
|
|
@ -112,19 +114,14 @@ module "controlplanes" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "time_sleep" "delay_before_workers" {
|
|
||||||
depends_on = [module.talos-image]
|
|
||||||
|
|
||||||
create_duration = "1s"
|
|
||||||
}
|
|
||||||
|
|
||||||
module "workers" {
|
module "workers" {
|
||||||
depends_on = [time_sleep.delay_before_workers]
|
depends_on = [module.talos-image]
|
||||||
|
|
||||||
source = "./modules/talos-node"
|
source = "./modules/talos-node"
|
||||||
for_each = { for node in local.workers.nodes : node.name => node }
|
for_each = { for node in local.workers.nodes : node.name => node }
|
||||||
|
|
||||||
node = {
|
node = {
|
||||||
|
id = local.vm-id_prefix + 20 + tonumber(replace(each.key, "worker", ""))
|
||||||
name = format("k8s-wheatley-%s", each.value.name)
|
name = format("k8s-wheatley-%s", each.value.name)
|
||||||
ipv4_address = each.value.ip_address
|
ipv4_address = each.value.ip_address
|
||||||
cpu = local.workers.cpu
|
cpu = local.workers.cpu
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ cluster:
|
||||||
disabled: true
|
disabled: true
|
||||||
extraManifests:
|
extraManifests:
|
||||||
- https://github.com/kubernetes-sigs/gateway-api/releases/download/v${gateway-api_version}/standard-install.yaml
|
- 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:
|
inlineManifests:
|
||||||
- name: cilium-bootstrap
|
- name: cilium-bootstrap
|
||||||
contents: |
|
contents: |
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ cluster:
|
||||||
disabled: true
|
disabled: true
|
||||||
extraManifests:
|
extraManifests:
|
||||||
- https://github.com/kubernetes-sigs/gateway-api/releases/download/v${gateway-api_version}/standard-install.yaml
|
- 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:
|
inlineManifests:
|
||||||
- name: cilium-bootstrap
|
- name: cilium-bootstrap
|
||||||
contents: |
|
contents: |
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ terraform {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "proxmox_virtual_environment_vm" "talos-node" {
|
resource "proxmox_virtual_environment_vm" "talos-node" {
|
||||||
|
vm_id = var.node.id
|
||||||
name = var.node.name
|
name = var.node.name
|
||||||
node_name = var.node.proxmox_node
|
node_name = var.node.proxmox_node
|
||||||
tags = ["tofu"]
|
tags = ["tofu"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
variable "node" {
|
variable "node" {
|
||||||
description = "Virtual node configuration"
|
description = "Virtual node configuration"
|
||||||
type = object({
|
type = object({
|
||||||
|
id = number
|
||||||
name = string
|
name = string
|
||||||
ipv4_address = string
|
ipv4_address = string
|
||||||
ipv4_gateway = string
|
ipv4_gateway = string
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,5 @@ terraform {
|
||||||
source = "bpg/proxmox"
|
source = "bpg/proxmox"
|
||||||
version = "0.85.1"
|
version = "0.85.1"
|
||||||
}
|
}
|
||||||
time = {
|
|
||||||
source = "hashicorp/time"
|
|
||||||
version = "0.11.1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue