From c37997ec0b23634cc36a1b308ae51cd7d7ed45e5 Mon Sep 17 00:00:00 2001 From: anatoleam Date: Tue, 5 Dec 2023 21:41:00 -0600 Subject: [PATCH] add config node --- terraform/config.template.yaml | 1 + terraform/deployment.tf | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/terraform/config.template.yaml b/terraform/config.template.yaml index c1723935..68e8163d 100644 --- a/terraform/config.template.yaml +++ b/terraform/config.template.yaml @@ -57,6 +57,7 @@ mongo: db: ${mongo_database} username: ${mongo_username} password: ${mongo_password} + hedged_reads: ${mongo_hedged_reads} meilisearch: host: ${meili_url} diff --git a/terraform/deployment.tf b/terraform/deployment.tf index 2f340b77..e4eb3f06 100644 --- a/terraform/deployment.tf +++ b/terraform/deployment.tf @@ -33,6 +33,7 @@ resource "kubernetes_secret" "app" { mongo_username = local.infra.mongodb_user_app.username mongo_password = local.infra.mongodb_user_app.password mongo_database = "7tv" + mongo_hedged_reads = var.mongo_use_hedged_reads meili_url = "http://meilisearch.database.svc.cluster.local:7700" meili_key = var.meilisearch_key meili_index = "emotes" @@ -56,15 +57,11 @@ resource "kubernetes_deployment" "app" { metadata { name = "api" namespace = data.kubernetes_namespace.app.metadata[0].name - labels = { + labels = { app = "api" } } - lifecycle { - replace_triggered_by = [kubernetes_secret.app] - } - timeouts { create = "4m" update = "5m" @@ -261,8 +258,8 @@ resource "kubernetes_service" "app" { resource "kubernetes_ingress_v1" "app" { metadata { - name = "api" - namespace = data.kubernetes_namespace.app.metadata[0].name + name = "api" + namespace = data.kubernetes_namespace.app.metadata[0].name annotations = { "kubernetes.io/ingress.class" = "nginx" "external-dns.alpha.kubernetes.io/target" = local.infra.cloudflare_tunnel_hostname.regular @@ -335,7 +332,7 @@ resource "kubernetes_horizontal_pod_autoscaler_v2" "api" { name = kubernetes_deployment.app.metadata[0].name } - min_replicas = 2 + min_replicas = local.infra.production ? 5 : 1 max_replicas = 14 metric {