The libvirt module can put the head's fabric NIC on an existing bridge (fabric_bridge) and make no compute guests (compute_vms); layout takes the machines' own MACs. envs/baremetal builds the head with it and drives the switch ports and BMCs through terraform_data provisioners. hpcod-switch assigns a port's VLAN by MAC on a VLAN-aware Linux bridge, and its libvirt hook re-applies it at each guest start. For a libvirt site the plan is the same, apart from fabric becoming fabric[0], which a moved block carries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
113 lines
3.0 KiB
Terraform
113 lines
3.0 KiB
Terraform
# The cluster contract (internal/provision.Contract): what the runner writes
|
|
# for every cluster, whatever the backend.
|
|
|
|
variable "cluster_id" { type = number }
|
|
variable "tenant_id" { type = number }
|
|
variable "tenant_name" { type = string }
|
|
variable "mgmt_ip_cidr" { type = string }
|
|
|
|
variable "head" {
|
|
type = object({
|
|
cores = number
|
|
memory_gb = number
|
|
disk_gb = number
|
|
})
|
|
}
|
|
variable "compute" {
|
|
type = object({
|
|
count = number
|
|
cores = number
|
|
memory_gb = number
|
|
})
|
|
}
|
|
|
|
variable "head_host" {
|
|
type = string
|
|
default = ""
|
|
}
|
|
variable "compute_hosts" {
|
|
type = list(string)
|
|
default = []
|
|
}
|
|
variable "devices" {
|
|
description = "Devices per compute node, keyed by 1-based index: host PCI addresses, passed through as hostdevs."
|
|
type = map(list(string))
|
|
default = {}
|
|
}
|
|
|
|
variable "apps" {
|
|
type = list(object({
|
|
name = string
|
|
image = string
|
|
digest = optional(string, "")
|
|
sif_sha256 = optional(string, "")
|
|
version = optional(string, "")
|
|
module = optional(string, "")
|
|
binaries = optional(list(string), [])
|
|
}))
|
|
default = []
|
|
}
|
|
|
|
variable "control_plane_cert" {
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
variable "started" {
|
|
description = "Power the compute nodes on. The build applies twice: off until the head's portal answers, then on."
|
|
type = bool
|
|
default = false
|
|
}
|
|
|
|
# The site, from site.auto.tfvars. The head host's are a libvirt site's.
|
|
|
|
variable "libvirt_uri" {
|
|
description = "The head host, as libvirt reaches it."
|
|
type = string
|
|
}
|
|
variable "pool" { type = string }
|
|
variable "head_base_path" { type = string }
|
|
variable "mgmt_bridge" { type = string }
|
|
variable "mgmt_gateway" { type = string }
|
|
variable "nameservers" { type = list(string) }
|
|
variable "mac_prefix" { type = string }
|
|
variable "ci_user" { type = string }
|
|
variable "ssh_public_keys" { type = list(string) }
|
|
|
|
# The rack's.
|
|
|
|
variable "site_id" {
|
|
description = "This site's id in the control plane's catalogue, which `hpcod baremetal` reads the BMCs and the switch from."
|
|
type = string
|
|
}
|
|
|
|
variable "fabric_bridge" {
|
|
description = "The head host's VLAN-aware bridge onto the fabric."
|
|
type = string
|
|
}
|
|
|
|
variable "vlan_base" {
|
|
description = "A cluster's VLAN is vlan_base + cluster_id. The same number the site's catalogue entry has, which discovery reads ports back with."
|
|
type = number
|
|
validation {
|
|
condition = var.vlan_base >= 2 && var.vlan_base + 254 <= 4094
|
|
error_message = "vlan_base must leave room for cluster ids up to 254 below VLAN 4095."
|
|
}
|
|
}
|
|
|
|
variable "machines" {
|
|
description = "The rack's machines by name, from the machines file: the MAC each network boots from."
|
|
type = map(object({ mac = string }))
|
|
}
|
|
|
|
variable "hpcod" {
|
|
description = "The control plane binary, which does what Terraform has no provider for: switch ports and BMCs."
|
|
type = string
|
|
default = "/usr/local/bin/hpcod"
|
|
}
|
|
|
|
variable "sites_file" {
|
|
type = string
|
|
default = "/etc/hpcod/sites.yaml"
|
|
}
|