diff --git a/modules/infra/argocd/application/application.tf b/modules/infra/argocd/application/application.tf index a9cd592..5534e3d 100644 --- a/modules/infra/argocd/application/application.tf +++ b/modules/infra/argocd/application/application.tf @@ -1,23 +1,46 @@ -resource "argocd_application" "fetch-system-streams" { +locals { + kustomize_applications = { + "fetch-system-streams" = {path: "fetch-system.streams/kustomize/overlays/dev", namespace: "fetch-system"}, + "fetch-system-worker" = {path: "fetch-system.worker/kustomize/overlays/dev", namespace: "fetch-system"}, + "fetch-system-util" = {path: "fetch-system.util/kustomize/overlays/dev", namespace: "fetch-system"}, + "fetch-system-polygon-proxy" = {path: "fetch-system.polygon-proxy/kustomize/overlays/dev", namespace: "fetch-system"} + } +} + +locals { + helm_applications = { + "fetch-system-telegraf" = { + values_path: "fetch-system.telegraf/helm/dev/values.yaml", + repository: "https://helm.influxdata.com/", + chart: "telegraf", + version: "1.8.55", + namespace: "fetch-system" + } + } +} + +resource "argocd_application" "kustomize_application" { + for_each = local.kustomize_applications + metadata { - name = "fetch-system-streams" + name = each.key namespace = "argocd" } cascade = true - wait = true - + wait = false + spec { project = "default" destination { server = "https://kubernetes.default.svc" - namespace = "fetch-system" + namespace = each.value.namespace } source { repo_url = "https://github.com/goboolean/manifests" - path = "fetch-system.streams/kustomize/overlays/dev" + path = each.value.path target_revision = "main" } @@ -33,27 +56,33 @@ resource "argocd_application" "fetch-system-streams" { } } -resource "argocd_application" "fetch-system-worker" { +resource "argocd_application" "helm_application" { + for_each = local.helm_applications + metadata { - name = "fetch-system-worker" + name = each.key namespace = "argocd" } cascade = true - wait = true - + wait = false + spec { project = "default" destination { server = "https://kubernetes.default.svc" - namespace = "fetch-system" + namespace = each.value.namespace } source { - repo_url = "https://github.com/goboolean/manifests" - path = "fetch-system.worker/kustomize/overlays/dev" - target_revision = "main" + repo_url = each.value.repository + chart = each.value.chart + target_revision = each.value.version + + helm { + value_files = [ "https://raw.githubusercontent.com/goboolean/manifests/refs/heads/main/${each.value.values_path}"] + } } sync_policy { diff --git a/modules/infra/kiali/main.tf b/modules/infra/kiali/main.tf index 96c5820..144cb10 100644 --- a/modules/infra/kiali/main.tf +++ b/modules/infra/kiali/main.tf @@ -7,7 +7,8 @@ resource "helm_release" "kiali_operator" { values = [templatefile("${path.module}/values.yaml", { prometheus_url = "http://kube-prometheus-stack-prometheus.monitoring.svc.cluster.local:9090" - grafana_url = "http://kube-prometheus-stack-grafana.monitoring.svc.cluster.local" + grafana_external_url = "https://grafana.goboolean.io" + grafana_internal_url = "http://kube-prometheus-stack-grafana.monitoring.svc.cluster.local:80" grafana_username = var.grafana_username grafana_password = var.grafana_password })] diff --git a/modules/infra/kiali/values.yaml b/modules/infra/kiali/values.yaml index fa3fdc2..4ad86fe 100644 --- a/modules/infra/kiali/values.yaml +++ b/modules/infra/kiali/values.yaml @@ -113,7 +113,8 @@ cr: username: ${grafana_username} dashboards: [] enabled: true - external_url: ${grafana_url} + external_url: ${grafana_external_url} + internal_url: ${grafana_internal_url} prometheus: auth: insecure_skip_verify: true diff --git a/projects/infra/main.tf b/projects/infra/main.tf index d54956c..fd5e4d9 100644 --- a/projects/infra/main.tf +++ b/projects/infra/main.tf @@ -23,11 +23,6 @@ module "harbor_policy" { } } - -module "argocd" { - source = "../../modules/infra/argocd" -} - module "kafka" { source = "../../modules/infra/kafka" } @@ -40,13 +35,17 @@ module "opentelemetry" { source = "../../modules/infra/opentelemetry" } -# module "argocd-application" { -# source = "../../modules/infra/argocd/application" -# depends_on = [module.argocd, module.namespace] -# providers = { -# argocd = argocd -# } -# } +module "argocd" { + source = "../../modules/infra/argocd" +} + +module "argocd-application" { + source = "../../modules/infra/argocd/application" + depends_on = [module.argocd] + providers = { + argocd = argocd + } +} data "vault_kv_secret_v2" "postgresql" { mount = "kv" @@ -71,11 +70,6 @@ module "influxdb" { influxdb_token = data.vault_kv_secret_v2.influxdb.data["token"] } -module "telegraf" { - source = "../../modules/infra/fetch-system/telegraf" - influxdb_token = data.vault_kv_secret_v2.influxdb.data["token"] -} - data "vault_kv_secret_v2" "grafana" { mount = "kv" name = "infra/grafana" diff --git a/projects/infra/provider.tf b/projects/infra/provider.tf index 4b75efa..3fdc7a3 100644 --- a/projects/infra/provider.tf +++ b/projects/infra/provider.tf @@ -43,8 +43,6 @@ locals { vault_secret_id = data.google_secret_manager_secret_version.vault_secret_id.secret_data } - - provider "google" { project = var.project_id region = var.region @@ -90,12 +88,6 @@ provider "kubectl" { load_config_file = false } -/* - The following infrastructure depends on Vault. - Therefore, it should be separated into a distinct module - and divided into stages. -*/ - data "vault_kv_secret_v2" "argocd" { mount = "kv" name = "infra/argocd"