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

461 lines
12 KiB
HCL

variable "kubeconfig_path" {
type = string
default = "/home/jv/.kube/config"
}
variable "external_monitoring_enabled" {
type = bool
default = false
}
variable "external_monitoring_host" {
type = string
default = ""
}
variable "pod_network_cidr" {
type = string
default = "10.244.0.0/16"
}
variable "calico_node_address_autodetection_cidrs" {
type = list(string)
default = ["192.168.100.0/24"]
}
variable "calico_operator_node_name" {
type = string
default = "debian"
}
variable "gitops_repo_url" {
type = string
default = "ssh://git@192.168.100.73:32222/jv/my-homelab-configs.git"
}
variable "gitops_ssh_key_path" {
type = string
default = "/home/jv/.ssh/id_ed25519"
}
variable "calico" {
type = object({
repository = string
version = string
namespace = string
})
default = {
repository = "https://docs.tigera.io/calico/charts"
version = "v3.32.0"
namespace = "tigera-operator"
}
}
variable "openebs" {
type = object({
repository = string
version = string
namespace = string
retain_storage_class = string
base_path = string
})
default = {
repository = "https://openebs.github.io/openebs"
version = "4.3.3"
namespace = "openebs"
retain_storage_class = "openebs-hostpath-retain"
base_path = "/data/openebs/local"
}
}
variable "argocd" {
type = object({
repository = string
version = string
namespace = string
repo_secret_name = string
})
default = {
repository = "https://argoproj.github.io/argo-helm"
version = "8.5.8"
namespace = "argocd"
repo_secret_name = "homelab-configs-repo"
}
}
variable "kyverno" {
type = object({
repository = string
chart_version = string
policies_version = string
namespace = string
})
default = {
repository = "https://kyverno.github.io/kyverno/"
chart_version = "3.8.1"
policies_version = "3.8.0"
namespace = "kyverno"
}
}
variable "nodelocal_dns" {
type = object({
enabled = bool
image = string
local_ip = string
cluster_dns_ip = string
cluster_domain = string
upstream_dns_servers = list(string)
})
default = {
enabled = false
image = "registry.k8s.io/dns/k8s-dns-node-cache:1.26.8"
local_ip = "169.254.20.10"
cluster_dns_ip = "10.96.0.10"
cluster_domain = "cluster.local"
upstream_dns_servers = ["1.1.1.1", "8.8.8.8"]
}
}
variable "metrics_server" {
type = object({
enabled = bool
repository = string
chart = string
version = string
namespace = string
})
default = {
enabled = true
repository = "https://kubernetes-sigs.github.io/metrics-server/"
chart = "metrics-server"
version = "3.13.1"
namespace = "kube-system"
}
}
variable "metallb" {
type = object({
enabled = bool
repository = string
version = string
namespace = string
address_pool = list(string)
l2_advertisement_enabled = bool
pool_name = string
})
default = {
enabled = true
repository = "https://metallb.github.io/metallb"
version = "0.16.0"
namespace = "metallb-system"
address_pool = ["192.168.100.240-192.168.100.240"]
l2_advertisement_enabled = true
pool_name = "homelab-lan"
}
}
variable "traefik" {
type = object({
enabled = bool
repository = string
chart_version = string
namespace = string
load_balancer_ip = string
ingress_class = string
})
default = {
enabled = true
repository = "https://helm.traefik.io/traefik"
chart_version = "40.2.0"
namespace = "traefik"
load_balancer_ip = "192.168.100.240"
ingress_class = "traefik"
}
}
variable "observability" {
type = object({
namespace = string
prometheus = object({
repository = string
chart = string
version = string
retention = string
storage_size = string
alertmanager_storage_size = string
grafana_storage_size = string
remote_write_mimir_enabled = bool
})
loki = object({
repository = string
chart = string
version = string
storage_size = string
retention_period = string
})
promtail = object({
repository = string
chart = string
version = string
})
mimir = object({
enabled = optional(bool, false)
repository = string
chart = string
version = string
minio_storage_size = string
alertmanager_storage_size = string
ingester_storage_size = string
store_gateway_storage_size = string
compactor_storage_size = string
})
})
default = {
namespace = "monitoring"
prometheus = {
repository = "https://prometheus-community.github.io/helm-charts"
chart = "kube-prometheus-stack"
version = "85.3.3"
retention = "7d"
storage_size = "15Gi"
alertmanager_storage_size = "1Gi"
grafana_storage_size = "2Gi"
remote_write_mimir_enabled = true
}
loki = {
repository = "https://grafana.github.io/helm-charts"
chart = "loki"
version = "7.0.0"
storage_size = "10Gi"
retention_period = "168h"
}
promtail = {
repository = "https://grafana.github.io/helm-charts"
chart = "promtail"
version = "6.17.1"
}
mimir = {
enabled = false
repository = "https://grafana.github.io/helm-charts"
chart = "mimir-distributed"
version = "5.8.0"
minio_storage_size = "10Gi"
alertmanager_storage_size = "1Gi"
ingester_storage_size = "4Gi"
store_gateway_storage_size = "4Gi"
compactor_storage_size = "4Gi"
}
}
}
variable "jeannie_self_heal_endpoint" {
description = "Host:port for the Debian-hosted Jeannie Alertmanager webhook and Prometheus metrics endpoint."
type = string
default = "192.168.100.73:18081"
}
variable "jeannie_api_metrics_target" {
description = "Host:port scraped by the in-cluster Prometheus for the Debian-hosted Jeannie API metrics endpoint."
type = string
default = "api.lab2025.duckdns.org:443"
}
variable "debian_host_metrics_target" {
description = "LAN host:port for the Debian laptop node exporter."
type = string
default = "192.168.100.73:9100"
}
variable "pimox_host_metrics_target" {
description = "LAN host:port for the Orange Pi hypervisor node exporter."
type = string
default = "192.168.100.80:9100"
}
variable "rpi_host_metrics_target" {
description = "LAN host:port for the Raspberry Pi node exporter."
type = string
default = "192.168.100.89:9100"
}
variable "debian_compose_metrics_target" {
description = "LAN host:port for the Debian Docker Compose cAdvisor collector."
type = string
default = "192.168.100.73:9101"
}
variable "rpi_compose_metrics_target" {
description = "LAN host:port for the Raspberry Pi Docker Compose cAdvisor collector."
type = string
default = "192.168.100.89:9101"
}
variable "oci_edge_metrics_target" {
description = "Optional private/restricted host:port for the OCI edge node exporter."
type = string
default = ""
}
variable "oci_edge_container_metrics_target" {
description = "Optional private/restricted host:port for the OCI edge cAdvisor endpoint."
type = string
default = ""
}
variable "oci_email_metrics_target" {
description = "Optional private/restricted host:port for the OCI email VM node exporter."
type = string
default = ""
}
variable "jeannie_api_metrics_token" {
description = "Bearer token used by Prometheus to scrape the authenticated Jeannie API metrics endpoint."
type = string
sensitive = true
default = ""
}
variable "metrics_server_manage_release" {
description = "Manage the metrics-server Helm release; false reuses an existing externally managed deployment and checks readiness."
type = bool
default = true
}
variable "prometheus_stack_node_selector" {
description = "Node selector applied to kube-prometheus-stack control workloads so they stay off the control plane."
type = map(string)
default = {
"kubernetes.io/os" = "linux"
"homelab.dev/workload-class" = "platform"
}
}
variable "cluster_profile" {
description = "Selected cluster profile attached to monitoring alerts and diagnostics."
type = string
default = "unselected"
}
variable "cluster_identity_uid" {
description = "Pinned kube-system UID attached to alerts to reject events from retired clusters."
type = string
default = ""
}
variable "tetragon_agent_enabled" {
description = "Enable the Tetragon agent after the pipeline finds at least one node with kernel BTF."
type = bool
default = false
}
variable "grafana_sso_enabled" {
description = "Enable Grafana Generic OAuth when the SSO stack's client-secret exists."
type = bool
default = false
}
variable "argocd_sso_enabled" {
description = "Enable Argo CD OIDC when the Dex client secret exists."
type = bool
default = false
}
variable "argocd_public_url" {
description = "Public Argo CD URL used for OIDC callbacks."
type = string
default = "https://argocd.lab2025.duckdns.org"
}
variable "grafana_oidc_url" {
description = "Public OIDC issuer URL used by Grafana's OAuth client."
type = string
default = ""
}
variable "grafana_public_url" {
description = "Public Grafana URL used for its OIDC redirect URI."
type = string
default = ""
}
variable "grafana_namespace" {
type = string
default = "monitoring"
}
variable "grafana_oauth_secret_name" {
type = string
default = "grafana-dex-oauth"
}
variable "extra_helm_releases" {
type = map(object({
repository = string
chart = string
version = string
namespace = string
create_namespace = bool
timeout = number
values_yaml = string
set_values = map(string)
}))
default = {
tetragon = {
repository = "https://helm.cilium.io"
chart = "tetragon"
# Tetragon 1.8 CRD CEL expressions are rejected by the k3s 1.31 API
# server; keep the known-compatible 1.7.1 chart until the CRDs are
# published with a schema compatible with this Kubernetes minor.
version = "1.7.1"
namespace = "kube-system"
create_namespace = false
timeout = 600
values_yaml = <<-EOT
tetragon:
enableProcessCred: true
enableProcessNs: true
exportFilename: tetragon.log
# Set both fields so upgrades/downgrades cannot retain an
# incompatible allowPrivilegeEscalation=false from an older pod
# template. This privileged eBPF agent requires host access.
securityContext:
privileged: true
allowPrivilegeEscalation: true
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
export:
resources:
requests:
cpu: 25m
memory: 64Mi
limits:
cpu: 100m
memory: 128Mi
EOT
set_values = {}
}
}
}
variable "external_loki_enabled" {
description = "Run Loki on Debian while preserving its cluster Service and PVC."
type = bool
default = false
}