add youtube-dlp module [ci skip]

This commit is contained in:
Viktor Barzin 2023-11-11 02:26:25 +00:00
parent bd4754b339
commit 03ddb0da8a
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
3 changed files with 158 additions and 0 deletions

View file

@ -327,3 +327,8 @@ module "redis" {
source = "./redis"
tls_secret_name = var.tls_secret_name
}
module "ytdlp" {
source = "./youtube_dl"
tls_secret_name = var.tls_secret_name
}

View file

@ -0,0 +1,153 @@
variable "tls_secret_name" {}
resource "kubernetes_namespace" "ytdlp" {
metadata {
name = "ytdlp"
}
}
module "tls_secret" {
source = "../setup_tls_secret"
namespace = "ytdlp"
tls_secret_name = var.tls_secret_name
}
resource "kubernetes_deployment" "ytdlp" {
# resource "kubernetes_daemonset" "technitium" {
metadata {
name = "ytdlp"
namespace = "ytdlp"
labels = {
app = "ytdlp"
}
}
spec {
# strategy {
# type = "Recreate"
# }
# replicas = 1
selector {
match_labels = {
app = "ytdlp"
}
}
template {
metadata {
labels = {
app = "ytdlp"
}
}
spec {
container {
image = "tzahi12345/youtubedl-material:latest"
name = "ytdlp"
# resources {
# limits = {
# cpu = "1"
# memory = "1Gi"
# }
# requests = {
# cpu = "1"
# memory = "1Gi"
# }
# }
port {
container_port = 17442
}
volume_mount {
mount_path = "/app/appdata"
name = "data"
}
volume_mount {
mount_path = "/app/audio"
name = "data"
}
volume_mount {
mount_path = "/app/video"
name = "data"
}
volume_mount {
mount_path = "/app/users"
name = "data"
}
volume_mount {
mount_path = "/app/subscriptions"
name = "data"
}
}
volume {
name = "data"
nfs {
path = "/mnt/main/ytdlp"
server = "10.0.10.15"
}
}
# }
}
}
}
}
resource "kubernetes_service" "ytdlp" {
metadata {
name = "ytdlp"
namespace = "ytdlp"
labels = {
"app" = "ytdlp"
}
# annotations = {
# "metallb.universe.tf/allow-shared-ip" : "shared"
# }
}
spec {
# type = "LoadBalancer"
# external_traffic_policy = "Cluster"
selector = {
app = "ytdlp"
}
port {
name = "ytdlp"
port = 80
target_port = 17442
protocol = "TCP"
}
}
}
resource "kubernetes_ingress_v1" "ytdlp" {
metadata {
name = "ytdlp-ingress"
namespace = "ytdlp"
annotations = {
"kubernetes.io/ingress.class" = "nginx"
"nginx.ingress.kubernetes.io/affinity" = "cookie"
# "nginx.ingress.kubernetes.io/auth-tls-verify-client" = "on"
# "nginx.ingress.kubernetes.io/auth-tls-secret" = "default/ca-secret"
# "nginx.ingress.kubernetes.io/auth-url" : "https://oauth2.viktorbarzin.me/oauth2/auth"
# "nginx.ingress.kubernetes.io/auth-signin" : "https://oauth2.viktorbarzin.me/oauth2/start?rd=/redirect/$http_host$escaped_request_uri"
}
}
spec {
tls {
hosts = ["yt.viktorbarzin.me"]
secret_name = var.tls_secret_name
}
rule {
host = "yt.viktorbarzin.me"
http {
path {
path = "/"
backend {
service {
name = "ytdlp"
port {
number = 80
}
}
}
}
}
}
}
}

Binary file not shown.