From d15434094fb2282de6f20548b2de50ee83afe616 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sun, 30 Mar 2025 11:14:49 +0000 Subject: [PATCH] add photon instance to dawarich [ci skip] --- modules/kubernetes/dawarich/main.tf | 96 ++++++++++++++++++++++++++--- 1 file changed, 87 insertions(+), 9 deletions(-) diff --git a/modules/kubernetes/dawarich/main.tf b/modules/kubernetes/dawarich/main.tf index 9d75bbac..1da6a67b 100644 --- a/modules/kubernetes/dawarich/main.tf +++ b/modules/kubernetes/dawarich/main.tf @@ -43,8 +43,8 @@ resource "kubernetes_deployment" "dawarich" { app = "dawarich" } annotations = { - "diun.enable" = "true" - "diun.include_tags" = "latest" + # "diun.enable" = "true" + # "diun.include_tags" = "latest" "prometheus.io/scrape" = "true" "prometheus.io/path" = "/metrics" "prometheus.io/port" = 9394 @@ -117,6 +117,11 @@ resource "kubernetes_deployment" "dawarich" { name = "PROMETHEUS_EXPORTER_HOST" value = "0.0.0.0" } + env { + name = "PHOTON_API_HOST" + value = "photon.dawarich" + } + # volume_mount { # name = "watched" @@ -176,25 +181,76 @@ resource "kubernetes_deployment" "dawarich" { name = "PROMETHEUS_EXPORTER_HOST" value = "dawarich.dawarich" } + env { + name = "PHOTON_API_HOST" + value = "photon.dawarich" + } # volume_mount { # name = "watched" # mount_path = "/var/app/tmp/imports/watched" # } } - volume { - name = "watched" - nfs { - path = "/mnt/main/dawarich" - server = "10.0.10.15" - } - } } } } } +resource "kubernetes_deployment" "photon" { + metadata { + name = "photon" + namespace = "dawarich" + labels = { + app = "photon" + } + } + spec { + replicas = 1 + strategy { + type = "Recreate" + } + selector { + match_labels = { + app = "photon" + } + } + template { + metadata { + labels = { + app = "photon" + } + } + spec { + + container { + image = "thomasnordquist/photon-geocoder:latest" + name = "photon" + port { + name = "tcp" + container_port = 2322 + } + + volume_mount { + name = "data" + mount_path = "/photon/photon_data" + } + } + volume { + name = "data" + nfs { + path = "/mnt/main/photon" + server = "10.0.10.15" + } + } + } + + } + } +} + + + resource "kubernetes_service" "dawarich" { metadata { name = "dawarich" @@ -216,6 +272,28 @@ resource "kubernetes_service" "dawarich" { } } } + +resource "kubernetes_service" "photon" { + metadata { + name = "photon" + namespace = "dawarich" + labels = { + "app" = "photon" + } + } + + spec { + selector = { + app = "photon" + } + port { + name = "http" + port = 2322 + target_port = 2322 + protocol = "TCP" + } + } +} module "ingress" { source = "../ingress_factory" namespace = "dawarich"