Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 43 additions & 14 deletions modules/infra/argocd/application/application.tf
Original file line number Diff line number Diff line change
@@ -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"
}

Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion modules/infra/kiali/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
})]
Expand Down
3 changes: 2 additions & 1 deletion modules/infra/kiali/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 11 additions & 17 deletions projects/infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ module "harbor_policy" {
}
}


module "argocd" {
source = "../../modules/infra/argocd"
}

module "kafka" {
source = "../../modules/infra/kafka"
}
Expand All @@ -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"
Expand All @@ -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"
Expand Down
8 changes: 0 additions & 8 deletions projects/infra/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down