my-homelab-configs/bootstrap/cluster/variables.tf

200 lines
4.2 KiB
HCL

variable "control_plane_node_name" {
type = string
default = "debian"
}
variable "cluster_runtime" {
type = string
description = "Control-plane runtime to install on the selected profile host."
default = "kubeadm"
validation {
condition = contains(["kubeadm", "k3s"], var.cluster_runtime)
error_message = "cluster_runtime must be kubeadm or k3s."
}
}
variable "k3s_version" {
type = string
description = "Pinned k3s release installed for the direct Debian profile."
default = "v1.31.5+k3s1"
}
variable "k3s_runtime_storage_path" {
description = "Optional SSD directory bind-mounted at the default K3s runtime path. Existing data requires the storage transition."
type = string
default = ""
validation {
condition = var.k3s_runtime_storage_path == "" || can(regex("^/[A-Za-z0-9_./-]+$", var.k3s_runtime_storage_path))
error_message = "Use an absolute storage path with safe characters."
}
}
variable "k3s_required_data_mount" {
description = "Writable data mount required before preparing SSD runtime storage."
type = string
default = ""
validation {
condition = var.k3s_required_data_mount == "" || can(regex("^/[A-Za-z0-9_./-]+$", var.k3s_required_data_mount))
error_message = "Use an absolute mount path with safe characters."
}
}
variable "k3s_allow_hypervisor_host" {
description = "Permit direct K3s on the retained hypervisor OS only while all its VMs are stopped."
type = bool
default = false
}
variable "control_plane_node_labels" {
type = map(string)
default = {
"homelab.dev/node-role" = "control-plane"
"homelab.dev/storage" = "data-vg"
"homelab.dev/workload-class" = "control-plane"
}
}
variable "control_plane_advertise_address" {
type = string
default = "192.168.100.73"
}
variable "control_plane_host" {
type = string
default = "192.168.100.73"
}
variable "control_plane_user" {
type = string
default = "jv"
}
variable "control_plane_ssh_key_path" {
type = string
default = "/home/jv/.ssh/id_ed25519"
}
variable "pod_network_cidr" {
type = string
default = "10.244.0.0/16"
}
variable "kubeconfig_path" {
type = string
default = "/home/jv/.kube/config"
}
variable "kubeconfig_owner" {
type = string
default = "jv:jv"
}
variable "registry_endpoint" {
type = string
default = "192.168.100.73:30500"
}
variable "node_dns_servers" {
type = list(string)
default = [
"1.1.1.1",
"8.8.8.8",
]
}
variable "persistent_volume_dirs" {
type = list(string)
default = [
"/data/openebs/local/registry",
]
}
variable "worker_nodes" {
type = map(object({
host = string
user = string
node_name = string
ssh_key_path = string
}))
default = {}
}
variable "allow_empty_worker_nodes" {
type = bool
default = false
}
variable "worker_node_labels" {
type = map(map(string))
default = {}
}
variable "force_worker_rejoin" {
type = bool
default = false
}
variable "worker_tailscale_enabled" {
type = bool
default = false
}
variable "worker_tailscale_accept_routes" {
type = bool
default = false
}
variable "worker_tailscale_pod_egress_snat" {
type = bool
default = true
}
variable "tailscale_nodeport_access" {
type = object({
enabled = bool
worker_key = string
peer_ip = string
node_tailscale_ip = string
pod_cidr = string
node_port = number
target_port = number
})
default = {
enabled = false
worker_key = "raspberrypi"
peer_ip = "100.118.255.19"
node_tailscale_ip = "100.77.80.72"
pod_cidr = "10.244.0.0/16"
node_port = 30080
target_port = 8080
}
}
variable "tailscale_nodeport_extra_ports" {
type = list(number)
default = []
}
variable "tailscale_nodeport_extra_target_ports" {
type = list(number)
default = []
}
variable "tailscale_subnet_routes" {
type = object({
enabled = bool
worker_key = string
routes = list(string)
})
default = {
enabled = true
worker_key = "raspberrypi"
routes = ["192.168.100.0/24"]
}
}