[ci skip] Move Terraform modules into stack directories
Move all 88 service modules (66 individual + 22 platform) from modules/kubernetes/<service>/ into their corresponding stack directories: - Service stacks: stacks/<service>/module/ - Platform stack: stacks/platform/modules/<service>/ This collocates module source code with its Terragrunt definition. Only shared utility modules remain in modules/kubernetes/: ingress_factory, setup_tls_secret, dockerhub_secret, oauth-proxy. All cross-references to shared modules updated to use correct relative paths. Verified with terragrunt run --all -- plan: 0 adds, 0 destroys across all 68 stacks.
This commit is contained in:
parent
73cb696f12
commit
e225e81ebf
614 changed files with 12075 additions and 352 deletions
40
stacks/coturn/.terraform.lock.hcl
generated
Normal file
40
stacks/coturn/.terraform.lock.hcl
generated
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.terraform.io/hashicorp/helm" {
|
||||
version = "3.1.1"
|
||||
hashes = [
|
||||
"h1:47CqNwkxctJtL/N/JuEj+8QMg8mRNI/NWeKO5/ydfZU=",
|
||||
"zh:1a6d5ce931708aec29d1f3d9e360c2a0c35ba5a54d03eeaff0ce3ca597cd0275",
|
||||
"zh:3411919ba2a5941801e677f0fea08bdd0ae22ba3c9ce3309f55554699e06524a",
|
||||
"zh:81b36138b8f2320dc7f877b50f9e38f4bc614affe68de885d322629dd0d16a29",
|
||||
"zh:95a2a0a497a6082ee06f95b38bd0f0d6924a65722892a856cfd914c0d117f104",
|
||||
"zh:9d3e78c2d1bb46508b972210ad706dd8c8b106f8b206ecf096cd211c54f46990",
|
||||
"zh:a79139abf687387a6efdbbb04289a0a8e7eaca2bd91cdc0ce68ea4f3286c2c34",
|
||||
"zh:aaa8784be125fbd50c48d84d6e171d3fb6ef84a221dbc5165c067ce05faab4c8",
|
||||
"zh:afecd301f469975c9d8f350cc482fe656e082b6ab0f677d1a816c3c615837cc1",
|
||||
"zh:c54c22b18d48ff9053d899d178d9ffef7d9d19785d9bf310a07d648b7aac075b",
|
||||
"zh:db2eefd55aea48e73384a555c72bac3f7d428e24147bedb64e1a039398e5b903",
|
||||
"zh:ee61666a233533fd2be971091cecc01650561f1585783c381b6f6e8a390198a4",
|
||||
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
|
||||
]
|
||||
}
|
||||
|
||||
provider "registry.terraform.io/hashicorp/kubernetes" {
|
||||
version = "3.0.1"
|
||||
hashes = [
|
||||
"h1:P0c8knzZnouTNFIRij8IS7+pqd0OKaFDYX0j4GRsiqo=",
|
||||
"zh:02d55b0b2238fd17ffa12d5464593864e80f402b90b31f6e1bd02249b9727281",
|
||||
"zh:20b93a51bfeed82682b3c12f09bac3031f5bdb4977c47c97a042e4df4fb2f9ba",
|
||||
"zh:6e14486ecfaee38c09ccf33d4fdaf791409f90795c1b66e026c226fad8bc03c7",
|
||||
"zh:8d0656ff422df94575668e32c310980193fccb1c28117e5c78dd2d4050a760a6",
|
||||
"zh:9795119b30ec0c1baa99a79abace56ac850b6e6fbce60e7f6067792f6eb4b5f4",
|
||||
"zh:b388c87acc40f6bd9620f4e23f01f3c7b41d9b88a68d5255dec0a72f0bdec249",
|
||||
"zh:b59abd0a980649c2f97f172392f080eaeb18e486b603f83bf95f5d93aeccc090",
|
||||
"zh:ba6e3060fddf4a022087d8f09e38aa0001c705f21170c2ded3d1c26c12f70d97",
|
||||
"zh:c12626d044b1d5501cf95ca78cbe507c13ad1dd9f12d4736df66eb8e5f336eb8",
|
||||
"zh:c55203240d50f4cdeb3df1e1760630d677679f5b1a6ffd9eba23662a4ad05119",
|
||||
"zh:ea206a5a32d6e0d6e32f1849ad703da9a28355d9c516282a8458b5cf1502b2a1",
|
||||
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
|
||||
]
|
||||
}
|
||||
6
stacks/coturn/backend.tf
Normal file
6
stacks/coturn/backend.tf
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa
|
||||
terraform {
|
||||
backend "local" {
|
||||
path = "/Users/viktorbarzin/code/infra/state/stacks/coturn/terraform.tfstate"
|
||||
}
|
||||
}
|
||||
|
|
@ -13,9 +13,9 @@ locals {
|
|||
}
|
||||
|
||||
module "coturn" {
|
||||
source = "../../modules/kubernetes/coturn"
|
||||
tls_secret_name = var.tls_secret_name
|
||||
tier = local.tiers.edge
|
||||
turn_secret = var.coturn_turn_secret
|
||||
public_ip = var.public_ip
|
||||
source = "./module"
|
||||
tls_secret_name = var.tls_secret_name
|
||||
tier = local.tiers.edge
|
||||
turn_secret = var.coturn_turn_secret
|
||||
public_ip = var.public_ip
|
||||
}
|
||||
|
|
|
|||
194
stacks/coturn/module/main.tf
Normal file
194
stacks/coturn/module/main.tf
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
variable "tls_secret_name" {}
|
||||
variable "tier" { type = string }
|
||||
variable "turn_secret" { type = string }
|
||||
variable "public_ip" { type = string }
|
||||
|
||||
locals {
|
||||
turn_realm = "viktorbarzin.me"
|
||||
turn_port = 3478
|
||||
# Small relay range — 100 ports is plenty for a home lab (~50 concurrent streams)
|
||||
min_port = 49152
|
||||
max_port = 49252
|
||||
}
|
||||
|
||||
resource "kubernetes_namespace" "coturn" {
|
||||
metadata {
|
||||
name = "coturn"
|
||||
labels = {
|
||||
tier = var.tier
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module "tls_secret" {
|
||||
source = "../../../modules/kubernetes/setup_tls_secret"
|
||||
namespace = kubernetes_namespace.coturn.metadata[0].name
|
||||
tls_secret_name = var.tls_secret_name
|
||||
}
|
||||
|
||||
resource "kubernetes_config_map" "coturn_config" {
|
||||
metadata {
|
||||
name = "coturn-config"
|
||||
namespace = kubernetes_namespace.coturn.metadata[0].name
|
||||
}
|
||||
|
||||
data = {
|
||||
"turnserver.conf" = <<-EOF
|
||||
# TURN server configuration
|
||||
listening-port=${local.turn_port}
|
||||
fingerprint
|
||||
lt-cred-mech
|
||||
use-auth-secret
|
||||
static-auth-secret=${var.turn_secret}
|
||||
realm=${local.turn_realm}
|
||||
server-name=turn.${local.turn_realm}
|
||||
|
||||
# Network — use 0.0.0.0, coturn auto-detects pod IP
|
||||
listening-ip=0.0.0.0
|
||||
external-ip=${var.public_ip}
|
||||
|
||||
# Media relay port range (narrow — 100 ports)
|
||||
min-port=${local.min_port}
|
||||
max-port=${local.max_port}
|
||||
|
||||
# Logging
|
||||
verbose
|
||||
no-stdout-log
|
||||
syslog
|
||||
|
||||
# Security
|
||||
no-multicast-peers
|
||||
no-cli
|
||||
no-tlsv1
|
||||
no-tlsv1_1
|
||||
|
||||
# Performance
|
||||
total-quota=100
|
||||
stale-nonce=600
|
||||
max-bps=0
|
||||
EOF
|
||||
}
|
||||
}
|
||||
|
||||
resource "kubernetes_deployment" "coturn" {
|
||||
metadata {
|
||||
name = "coturn"
|
||||
namespace = kubernetes_namespace.coturn.metadata[0].name
|
||||
labels = {
|
||||
app = "coturn"
|
||||
tier = var.tier
|
||||
}
|
||||
}
|
||||
|
||||
spec {
|
||||
replicas = 1
|
||||
strategy {
|
||||
type = "RollingUpdate"
|
||||
rolling_update {
|
||||
max_unavailable = 0
|
||||
max_surge = 1
|
||||
}
|
||||
}
|
||||
selector {
|
||||
match_labels = {
|
||||
app = "coturn"
|
||||
}
|
||||
}
|
||||
|
||||
template {
|
||||
metadata {
|
||||
labels = {
|
||||
app = "coturn"
|
||||
}
|
||||
}
|
||||
|
||||
spec {
|
||||
container {
|
||||
name = "coturn"
|
||||
image = "coturn/coturn:latest"
|
||||
args = ["-c", "/etc/turnserver/turnserver.conf"]
|
||||
|
||||
# STUN/TURN signaling port
|
||||
port {
|
||||
name = "turn-udp"
|
||||
container_port = local.turn_port
|
||||
protocol = "UDP"
|
||||
}
|
||||
port {
|
||||
name = "turn-tcp"
|
||||
container_port = local.turn_port
|
||||
protocol = "TCP"
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
name = "config"
|
||||
mount_path = "/etc/turnserver"
|
||||
read_only = true
|
||||
}
|
||||
|
||||
resources {
|
||||
requests = {
|
||||
cpu = "100m"
|
||||
memory = "128Mi"
|
||||
}
|
||||
limits = {
|
||||
cpu = "1"
|
||||
memory = "512Mi"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
volume {
|
||||
name = "config"
|
||||
config_map {
|
||||
name = kubernetes_config_map.coturn_config.metadata[0].name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# LoadBalancer service with MetalLB — exposes STUN/TURN signaling + relay ports
|
||||
resource "kubernetes_service" "coturn" {
|
||||
metadata {
|
||||
name = "coturn"
|
||||
namespace = kubernetes_namespace.coturn.metadata[0].name
|
||||
annotations = {
|
||||
"metallb.universe.tf/loadBalancerIPs" = "10.0.20.200"
|
||||
"metallb.universe.tf/allow-shared-ip" = "shared"
|
||||
}
|
||||
}
|
||||
|
||||
spec {
|
||||
type = "LoadBalancer"
|
||||
selector = {
|
||||
app = "coturn"
|
||||
}
|
||||
|
||||
# STUN/TURN signaling
|
||||
port {
|
||||
name = "turn-udp"
|
||||
port = local.turn_port
|
||||
target_port = local.turn_port
|
||||
protocol = "UDP"
|
||||
}
|
||||
port {
|
||||
name = "turn-tcp"
|
||||
port = local.turn_port
|
||||
target_port = local.turn_port
|
||||
protocol = "TCP"
|
||||
}
|
||||
|
||||
# Relay port range (49152-49252)
|
||||
dynamic "port" {
|
||||
for_each = range(local.min_port, local.max_port + 1)
|
||||
content {
|
||||
name = "relay-${port.value}"
|
||||
port = port.value
|
||||
target_port = port.value
|
||||
protocol = "UDP"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
stacks/coturn/providers.tf
Normal file
15
stacks/coturn/providers.tf
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa
|
||||
variable "kube_config_path" {
|
||||
type = string
|
||||
default = "~/.kube/config"
|
||||
}
|
||||
|
||||
provider "kubernetes" {
|
||||
config_path = var.kube_config_path
|
||||
}
|
||||
|
||||
provider "helm" {
|
||||
kubernetes = {
|
||||
config_path = var.kube_config_path
|
||||
}
|
||||
}
|
||||
1
stacks/coturn/secrets
Symbolic link
1
stacks/coturn/secrets
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../secrets
|
||||
Loading…
Add table
Add a link
Reference in a new issue