change the variable type to make it automatic with the image name
This commit is contained in:
@@ -35,9 +35,11 @@ variable "kubernetes" {
|
|||||||
liveness_tcp_socket = optional(number)
|
liveness_tcp_socket = optional(number)
|
||||||
liveness_http_get = optional(string)
|
liveness_http_get = optional(string)
|
||||||
liveness_http_get_path = optional(string)
|
liveness_http_get_path = optional(string)
|
||||||
database = optional(map(object({
|
database = optional(map(string))
|
||||||
image = optional(string)
|
# database = optional(map(object({
|
||||||
})))
|
# image = optional(string, "docker.io/library/postgres:latest")
|
||||||
|
# })), null)
|
||||||
|
redis = optional(map(string))
|
||||||
enabled = optional(bool, true)
|
enabled = optional(bool, true)
|
||||||
requirements = optional(map(string), {
|
requirements = optional(map(string), {
|
||||||
limits-cpu = "800m"
|
limits-cpu = "800m"
|
||||||
@@ -327,7 +329,9 @@ resource "kubernetes_deployment_v1" "automatic" {
|
|||||||
|
|
||||||
|
|
||||||
resource "kubernetes_deployment_v1" "database-automatic" {
|
resource "kubernetes_deployment_v1" "database-automatic" {
|
||||||
for_each = { for key, value in var.kubernetes : key => value if value.enabled == true }
|
for_each = { for key, value in var.kubernetes : key => value if value.database != null && value.enabled == true }
|
||||||
|
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
namespace = coalesce(each.value.namespace, each.key)
|
namespace = coalesce(each.value.namespace, each.key)
|
||||||
name = "${coalesce(each.value.namespace, each.key)}-db"
|
name = "${coalesce(each.value.namespace, each.key)}-db"
|
||||||
@@ -358,7 +362,7 @@ resource "kubernetes_deployment_v1" "database-automatic" {
|
|||||||
|
|
||||||
spec {
|
spec {
|
||||||
container {
|
container {
|
||||||
image = "docker.io/library/postgres:14"
|
image = try(each.value.database.image, "docker.io/library/postgres:latest")
|
||||||
name = "${coalesce(each.value.name, each.key)}-db"
|
name = "${coalesce(each.value.name, each.key)}-db"
|
||||||
port {
|
port {
|
||||||
|
|
||||||
|
|||||||
+95
-5
@@ -26,11 +26,10 @@ kubernetes = {
|
|||||||
namespace = "onitama"
|
namespace = "onitama"
|
||||||
image = "ghcr.io/jackadamson/onitama:latest"
|
image = "ghcr.io/jackadamson/onitama:latest"
|
||||||
service_port = 8080
|
service_port = 8080
|
||||||
database = {
|
redis = {
|
||||||
# username = "username"
|
image = "hello"
|
||||||
# database = "database"
|
|
||||||
# password = "password"
|
|
||||||
}
|
}
|
||||||
|
database = {}
|
||||||
requirements = {
|
requirements = {
|
||||||
limits-cpu = "50m"
|
limits-cpu = "50m"
|
||||||
limits-memory = "50Mi"
|
limits-memory = "50Mi"
|
||||||
@@ -103,11 +102,15 @@ kubernetes = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nginx = {
|
nginx = {
|
||||||
enabled = false
|
enabled = true
|
||||||
namespace = "testnginx"
|
namespace = "testnginx"
|
||||||
#image = "localhost:31795/django-python"
|
#image = "localhost:31795/django-python"
|
||||||
image = "nginx:latest"
|
image = "nginx:latest"
|
||||||
|
database = {
|
||||||
|
# "image" = "mysql:latest"
|
||||||
|
}
|
||||||
#pvc_size = "10Mi"
|
#pvc_size = "10Mi"
|
||||||
# mount_path = "/code"
|
# mount_path = "/code"
|
||||||
# service_port = 80
|
# service_port = 80
|
||||||
@@ -310,6 +313,93 @@ kubernetes = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paper = {
|
||||||
|
enabled = false
|
||||||
|
namespace = "paper"
|
||||||
|
image = "ghcr.io/paperless-ngx/paperless-ngx:latest"
|
||||||
|
service_port = 8000
|
||||||
|
database = {}
|
||||||
|
requirements = {
|
||||||
|
limits-cpu = "50m"
|
||||||
|
limits-memory = "50Mi"
|
||||||
|
requests-cpu = "25m"
|
||||||
|
requests-memory = "25Mi"
|
||||||
|
}
|
||||||
|
environment = {
|
||||||
|
POSTGRES_DB = {
|
||||||
|
value_from = {
|
||||||
|
secret_key_ref = {
|
||||||
|
name = "mysecret"
|
||||||
|
key = "POSTGRES_DB"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
POSTGRES_USER = {
|
||||||
|
value_from = {
|
||||||
|
secret_key_ref = {
|
||||||
|
name = "mysecret"
|
||||||
|
key = "POSTGRES_USER"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
POSTGRES_PASSWORD = {
|
||||||
|
value_from = {
|
||||||
|
secret_key_ref = {
|
||||||
|
name = "mysecret"
|
||||||
|
key = "POSTGRES_PASSWORD"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PAPERLESS_URL = {
|
||||||
|
value = "https://paper.tryton.geeraert.eu"
|
||||||
|
}
|
||||||
|
PAPERLESS_DBHOST = {
|
||||||
|
value_from = {
|
||||||
|
secret_key_ref = {
|
||||||
|
name = "mysecret"
|
||||||
|
key = "POSTGRES_DB"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PAPERLESS_ADMIN_USER = {
|
||||||
|
value = "admin"
|
||||||
|
}
|
||||||
|
PAPERLESS_ADMIN_PASSWORD = {
|
||||||
|
value = "admin"
|
||||||
|
}
|
||||||
|
|
||||||
|
PAPERLESS_OCR_USER_ARGS = {
|
||||||
|
value = "{'invalidate_digital_signatures': true}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pvc = {
|
||||||
|
paperless-data = {
|
||||||
|
name = "paperless-data"
|
||||||
|
pvc_size = "2Mi"
|
||||||
|
mount_path = "/usr/src/paperless/data"
|
||||||
|
}
|
||||||
|
media = {
|
||||||
|
name = "media"
|
||||||
|
pvc_size = "2Mi"
|
||||||
|
mount_path = "/usr/src/paperless/media"
|
||||||
|
}
|
||||||
|
export = {
|
||||||
|
name = "export"
|
||||||
|
pvc_size = "2Mi"
|
||||||
|
mount_path = "/usr/src/paperless/export"
|
||||||
|
}
|
||||||
|
consume = {
|
||||||
|
name = "consume"
|
||||||
|
pvc_size = "2Mi"
|
||||||
|
mount_path = "/usr/src/paperless/consume"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user