You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
2.7 KiB

resource "kubernetes_persistent_volume_claim" "babybuddy" {
metadata {
name = "babybuddy"
}
spec {
access_modes = ["ReadWriteOnce"]
resources {
requests = {
storage = "2Gi"
}
}
storage_class_name = "linode-block-storage-retain"
}
}
# resource "kubernetes_pod" "babybuddy" {
# metadata {
# name = "babybuddy"
# labels = {
# app = "babybuddy"
# }
# }
# spec {
# container {
# # https://github.com/babybuddy/babybuddy/issues/337
# image = "lscr.io/linuxserver/babybuddy:v1.9.0-ls14"
# image_pull_policy = "Always"
# name = "babybuddy"
# port {
# container_port = 8000
# }
# volume_mount {
# name = "babybuddy"
# mount_path = "/config"
# }
# }
# volume {
# name = "babybuddy"
# persistent_volume_claim {
# claim_name = "babybuddy"
# }
# }
# }
# }
resource "kubernetes_deployment" "babybuddy" {
metadata {
name = "babybuddy"
}
spec {
selector {
match_labels = {
app = "babybuddy"
}
}
strategy {
type = "Recreate"
}
template {
metadata {
labels = {
app = "babybuddy"
}
}
spec {
container {
# https://github.com/babybuddy/babybuddy/issues/337
image = "lscr.io/linuxserver/babybuddy:v1.9.0-ls14"
name = "babybuddy"
image_pull_policy = "Always"
port {
container_port = 8000
}
volume_mount {
name = "babybuddy"
mount_path = "/config"
}
}
volume {
name = "babybuddy"
persistent_volume_claim {
claim_name = "babybuddy"
}
}
}
}
}
}
resource "kubernetes_service" "babybuddy" {
metadata {
name = "babybuddy"
}
spec {
port {
port = 80
target_port = 8000
protocol = "TCP"
}
selector = {
app = "babybuddy"
}
}
}
resource "kubernetes_ingress_v1" "babybuddy" {
metadata {
name = "babybuddy"
annotations = {
"kubernetes.io/ingress.class" = "nginx"
"cert-manager.io/cluster-issuer" = "letsencrypt-prod"
}
}
spec {
tls {
hosts = [
"babybuddy.${var.domain}"
]
secret_name = "babybuddy-tls"
}
rule {
host = "babybuddy.${var.domain}"
http {
path {
path = "/"
path_type = "Prefix"
backend {
service {
name = "babybuddy"
port {
number = 80
}
}
}
}
}
}
}
}