add semi working authelia [ci skip]

This commit is contained in:
Viktor Barzin 2025-12-28 20:02:28 +00:00
parent a0321d4473
commit 14538a02c0
2 changed files with 169 additions and 1860 deletions

View file

@ -15,163 +15,164 @@ module "tls_secret" {
tls_secret_name = var.tls_secret_name tls_secret_name = var.tls_secret_name
} }
# resource "helm_release" "authelia" { resource "helm_release" "authelia" {
# namespace = "authelia" namespace = "authelia"
# create_namespace = true name = "authelia"
# name = "authelia" atomic = true
# atomic = true
# repository = "https://charts.authelia.com" repository = "https://charts.authelia.com"
# chart = "authelia" chart = "authelia"
# version = "4.38.9" version = "0.10.49"
# values = [templatefile("${path.module}/values.yaml", {})] depends_on = [kubernetes_namespace.authelia]
values = [templatefile("${path.module}/values.yaml", {})]
}
# resource "kubernetes_config_map" "configuration" {
# metadata {
# name = "configuration"
# namespace = "authelia"
# labels = {
# app = "configuration"
# }
# annotations = {
# "reloader.stakater.com/match" = "true"
# }
# }
# data = {
# # "configuration.yml" = yamldecode(file("${path.module}/configuration.yml"))
# "configuration.yml" = file("${path.module}/configuration.yml")
# "users_database.yml" = file("${path.module}/users_database.yml")
# }
# } # }
resource "kubernetes_config_map" "configuration" {
metadata {
name = "configuration"
namespace = "authelia"
labels = { # resource "kubernetes_deployment" "authelia" {
app = "configuration" # metadata {
} # name = "authelia"
annotations = { # namespace = "authelia"
"reloader.stakater.com/match" = "true" # labels = {
} # app = "authelia"
} # }
# annotations = {
# "reloader.stakater.com/search" = "true"
# }
# }
# spec {
# replicas = 1
# selector {
# match_labels = {
# app = "authelia"
# }
# }
# template {
# metadata {
# labels = {
# app = "authelia"
# }
# }
# spec {
# container {
# image = "authelia/authelia:4.38"
# name = "authelia"
# # command = ["tail", "-f", "/etc/passwd"]
data = { # port {
# "configuration.yml" = yamldecode(file("${path.module}/configuration.yml")) # container_port = 9091
"configuration.yml" = file("${path.module}/configuration.yml") # }
"users_database.yml" = file("${path.module}/users_database.yml") # port {
} # container_port = 8080
} # }
# volume_mount {
# name = "config"
# # mount_path = "/etc/authelia/configuration.yml"
# mount_path = "/config/configuration.yml"
# sub_path = "configuration.yml"
# }
# volume_mount {
# name = "users-database"
# # mount_path = "/etc/authelia/users_database.yml"
# mount_path = "/config/users_database.yml"
# sub_path = "users_database.yml"
# }
# }
# volume {
# name = "config"
# config_map {
# name = "configuration"
# }
# }
# volume {
# name = "users-database"
# config_map {
# name = "configuration"
# }
# }
# }
# }
# }
# }
# resource "kubernetes_service" "authelia" {
# metadata {
# name = "authelia"
# namespace = "authelia"
# labels = {
# "app" = "authelia"
# }
# }
resource "kubernetes_deployment" "authelia" { # spec {
metadata { # selector = {
name = "authelia" # app = "authelia"
namespace = "authelia" # }
labels = { # port {
app = "authelia" # name = "http"
} # port = 80
annotations = { # protocol = "TCP"
"reloader.stakater.com/search" = "true" # # target_port = 8080
} # target_port = 9091
} # }
spec { # }
replicas = 1 # }
selector {
match_labels = {
app = "authelia"
}
}
template {
metadata {
labels = {
app = "authelia"
}
}
spec {
container {
image = "authelia/authelia:4.38"
name = "authelia"
# command = ["tail", "-f", "/etc/passwd"]
port { # resource "kubernetes_ingress_v1" "authelia" {
container_port = 9091 # metadata {
} # name = "authelia"
port { # namespace = "authelia"
container_port = 8080 # annotations = {
} # "kubernetes.io/ingress.class" = "nginx"
volume_mount { # # "nginx.ingress.kubernetes.io/affinity" = "cookie"
name = "config" # # "nginx.ingress.kubernetes.io/auth-tls-verify-client" = "on"
# mount_path = "/etc/authelia/configuration.yml" # # "nginx.ingress.kubernetes.io/auth-tls-secret" = "default/ca-secret"
mount_path = "/config/configuration.yml" # # "nginx.ingress.kubernetes.io/auth-url" : "https://oauth2.viktorbarzin.me/oauth2/auth"
sub_path = "configuration.yml" # # "nginx.ingress.kubernetes.io/auth-signin" : "https://oauth2.viktorbarzin.me/oauth2/start?rd=/redirect/$http_host$escaped_request_uri"
} # }
volume_mount { # }
name = "users-database"
# mount_path = "/etc/authelia/users_database.yml"
mount_path = "/config/users_database.yml"
sub_path = "users_database.yml"
}
}
volume {
name = "config"
config_map {
name = "configuration"
}
}
volume {
name = "users-database"
config_map {
name = "configuration"
}
}
}
}
}
}
resource "kubernetes_service" "authelia" { # spec {
metadata { # tls {
name = "authelia" # hosts = ["auth.viktorbarzin.me"]
namespace = "authelia" # secret_name = var.tls_secret_name
labels = { # }
"app" = "authelia" # rule {
} # host = "auth.viktorbarzin.me"
} # http {
# path {
spec { # path = "/"
selector = { # backend {
app = "authelia" # service {
} # name = "authelia"
port { # port {
name = "http" # number = 80
port = 80 # }
protocol = "TCP" # }
# target_port = 8080 # }
target_port = 9091 # }
} # }
} # }
} # }
# }
resource "kubernetes_ingress_v1" "authelia" {
metadata {
name = "authelia"
namespace = "authelia"
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 = ["auth.viktorbarzin.me"]
secret_name = var.tls_secret_name
}
rule {
host = "auth.viktorbarzin.me"
http {
path {
path = "/"
backend {
service {
name = "authelia"
port {
number = 80
}
}
}
}
}
}
}
}

File diff suppressed because it is too large Load diff