[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
215
stacks/frigate/module/main.tf
Normal file
215
stacks/frigate/module/main.tf
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
variable "tls_secret_name" {}
|
||||
variable "tier" { type = string }
|
||||
|
||||
resource "kubernetes_namespace" "frigate" {
|
||||
metadata {
|
||||
name = "frigate"
|
||||
labels = {
|
||||
tier = var.tier
|
||||
}
|
||||
# labels = {
|
||||
# "istio-injection" : "enabled"
|
||||
# }
|
||||
}
|
||||
}
|
||||
|
||||
module "tls_secret" {
|
||||
source = "../../../modules/kubernetes/setup_tls_secret"
|
||||
namespace = kubernetes_namespace.frigate.metadata[0].name
|
||||
tls_secret_name = var.tls_secret_name
|
||||
}
|
||||
|
||||
resource "kubernetes_deployment" "frigate" {
|
||||
metadata {
|
||||
name = "frigate"
|
||||
namespace = kubernetes_namespace.frigate.metadata[0].name
|
||||
labels = {
|
||||
app = "frigate"
|
||||
tier = var.tier
|
||||
}
|
||||
annotations = {
|
||||
"reloader.stakater.com/search" = "true"
|
||||
}
|
||||
}
|
||||
spec {
|
||||
replicas = 1 # Temporarily disabled due to high power consumption
|
||||
strategy {
|
||||
type = "Recreate"
|
||||
}
|
||||
selector {
|
||||
match_labels = {
|
||||
app = "frigate"
|
||||
}
|
||||
}
|
||||
template {
|
||||
metadata {
|
||||
labels = {
|
||||
app = "frigate"
|
||||
}
|
||||
}
|
||||
spec {
|
||||
node_selector = {
|
||||
"gpu" : true
|
||||
}
|
||||
toleration {
|
||||
key = "nvidia.com/gpu"
|
||||
operator = "Equal"
|
||||
value = "true"
|
||||
effect = "NoSchedule"
|
||||
}
|
||||
container {
|
||||
# image = "ghcr.io/blakeblackshear/frigate:stable"
|
||||
# image = "ghcr.io/blakeblackshear/frigate:stable-tensorrt"
|
||||
image = "ghcr.io/blakeblackshear/frigate:0.17.0-beta1-tensorrt"
|
||||
name = "frigate"
|
||||
|
||||
resources {
|
||||
limits = {
|
||||
"nvidia.com/gpu" = "1"
|
||||
}
|
||||
}
|
||||
env {
|
||||
name = "FRIGATE_RTSP_PASSWORD"
|
||||
value = "password"
|
||||
}
|
||||
port {
|
||||
container_port = 5000
|
||||
}
|
||||
port {
|
||||
container_port = 8554
|
||||
}
|
||||
port {
|
||||
container_port = 8555
|
||||
protocol = "TCP"
|
||||
}
|
||||
port {
|
||||
container_port = 8555
|
||||
protocol = "UDP"
|
||||
}
|
||||
volume_mount {
|
||||
name = "config"
|
||||
mount_path = "/config"
|
||||
}
|
||||
volume_mount {
|
||||
name = "dri"
|
||||
mount_path = "/dev/dri"
|
||||
}
|
||||
volume_mount {
|
||||
name = "dshm"
|
||||
mount_path = "/dev/shm"
|
||||
}
|
||||
volume_mount {
|
||||
name = "media"
|
||||
mount_path = "/media/frigate"
|
||||
}
|
||||
security_context {
|
||||
privileged = true
|
||||
}
|
||||
}
|
||||
|
||||
volume {
|
||||
name = "config"
|
||||
nfs {
|
||||
path = "/mnt/main/frigate/config"
|
||||
server = "10.0.10.15"
|
||||
}
|
||||
}
|
||||
volume {
|
||||
name = "dshm"
|
||||
empty_dir {
|
||||
medium = "Memory"
|
||||
size_limit = "1Gi"
|
||||
}
|
||||
}
|
||||
volume {
|
||||
name = "media"
|
||||
nfs {
|
||||
path = "/mnt/main/frigate/media"
|
||||
server = "10.0.10.15"
|
||||
}
|
||||
}
|
||||
volume {
|
||||
name = "dri"
|
||||
host_path {
|
||||
path = "/dev/dri"
|
||||
type = "Directory"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "kubernetes_service" "frigate" {
|
||||
metadata {
|
||||
name = "frigate"
|
||||
namespace = kubernetes_namespace.frigate.metadata[0].name
|
||||
labels = {
|
||||
"app" = "frigate"
|
||||
}
|
||||
}
|
||||
|
||||
spec {
|
||||
selector = {
|
||||
app = "frigate"
|
||||
}
|
||||
port {
|
||||
name = "http"
|
||||
target_port = 5000
|
||||
port = 80
|
||||
protocol = "TCP"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "kubernetes_service" "frigate-rtsp" {
|
||||
metadata {
|
||||
name = "frigate-rtsp"
|
||||
namespace = kubernetes_namespace.frigate.metadata[0].name
|
||||
labels = {
|
||||
"app" = "frigate"
|
||||
}
|
||||
}
|
||||
|
||||
spec {
|
||||
type = "NodePort" # Should always live on node1 where the gpu is
|
||||
selector = {
|
||||
app = "frigate"
|
||||
}
|
||||
port {
|
||||
name = "rtsp-tcp"
|
||||
target_port = 8554
|
||||
port = 8554
|
||||
protocol = "TCP"
|
||||
node_port = 30554
|
||||
}
|
||||
port {
|
||||
name = "rtsp-udp"
|
||||
target_port = 8554
|
||||
port = 8554
|
||||
protocol = "UDP"
|
||||
node_port = 30554
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module "ingress" {
|
||||
source = "../../../modules/kubernetes/ingress_factory"
|
||||
namespace = kubernetes_namespace.frigate.metadata[0].name
|
||||
name = "frigate"
|
||||
tls_secret_name = var.tls_secret_name
|
||||
protected = true
|
||||
rybbit_site_id = "0d4044069ff5"
|
||||
}
|
||||
|
||||
module "ingress-internal" {
|
||||
source = "../../../modules/kubernetes/ingress_factory"
|
||||
namespace = kubernetes_namespace.frigate.metadata[0].name
|
||||
name = "frigate-lan"
|
||||
host = "frigate-lan"
|
||||
root_domain = "viktorbarzin.lan"
|
||||
service_name = "frigate"
|
||||
tls_secret_name = var.tls_secret_name
|
||||
allow_local_access_only = true
|
||||
ssl_redirect = false
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue