From 41c9d3d6f6e86f95133dae58158192a559a81c75 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Mon, 7 Aug 2023 11:31:35 -0700 Subject: [PATCH] Adjust down default service stunnel sidecar resources Keep photoprism and lidarr, database heavy tools, at the same level --- services/main.tf | 10 +++++++++- services/service/main.tf | 1 + services/service/service_template.nomad | 5 +++-- services/service/vars.tf | 16 ++++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/services/main.tf b/services/main.tf index bd88ae7..2e745f7 100644 --- a/services/main.tf +++ b/services/main.tf @@ -85,6 +85,10 @@ module "photoprism_module" { memory = 3000 memory_max = 4000 } + stunnel_resources = { + cpu = 100 + memory = 100 + } sticky_disk = true host_volumes = [ { @@ -99,7 +103,6 @@ module "photoprism_module" { }, ] - ingress = true service_port = 2342 ingress_middlewares = [ @@ -253,4 +256,9 @@ module "lidarr" { cpu = 500 memory = 1500 } + + stunnel_resources = { + cpu = 100 + memory = 100 + } } diff --git a/services/service/main.tf b/services/service/main.tf index 84c3c5a..6070060 100644 --- a/services/service/main.tf +++ b/services/service/main.tf @@ -17,6 +17,7 @@ resource "nomad_job" "service" { ports = var.ports sticky_disk = var.sticky_disk resources = var.resources + stunnel_resources = var.stunnel_resources service_tags = var.service_tags custom_services = var.custom_services diff --git a/services/service/service_template.nomad b/services/service/service_template.nomad index e2e6a2b..49fe50d 100644 --- a/services/service/service_template.nomad +++ b/services/service/service_template.nomad @@ -334,8 +334,9 @@ $$; } resources { - cpu = 100 - memory = 100 + cpu = ${stunnel_resources.cpu} + memory = ${stunnel_resources.memory} + %{ if stunnel_resources.memory_max != null }memory_max = ${stunnel_resources.memory_max}%{ endif } } template { diff --git a/services/service/vars.tf b/services/service/vars.tf index 1d0a0f9..43b1090 100644 --- a/services/service/vars.tf +++ b/services/service/vars.tf @@ -89,6 +89,22 @@ variable "resources" { description = "Resources to be assigned to the main task" } +variable "stunnel_resources" { + type = object({ + cpu = number + memory = number + memory_max = optional(number) + }) + + default = { + cpu = 50 + memory = 50 + memory_max = null + } + + description = "Resources to be assigned to the stunnel sidecar task" +} + variable "env" { type = map(string) default = {}