From 51ec4b31e7f34b65af623793c61c8fe0ee0c9e0d Mon Sep 17 00:00:00 2001 From: incubator4 Date: Wed, 25 Oct 2023 16:02:08 +0800 Subject: [PATCH] feat: add vm --- .../workflows/{apply.yaml => apply.yaml.bak} | 0 application_set.tf | 60 +++++++++++++++++++ repository.tf | 5 ++ victoriametrics/dev/kustomization.yaml | 5 ++ victoriametrics/prod/kustomization.yaml | 4 ++ 5 files changed, 74 insertions(+) rename .github/workflows/{apply.yaml => apply.yaml.bak} (100%) create mode 100644 repository.tf create mode 100644 victoriametrics/dev/kustomization.yaml create mode 100644 victoriametrics/prod/kustomization.yaml diff --git a/.github/workflows/apply.yaml b/.github/workflows/apply.yaml.bak similarity index 100% rename from .github/workflows/apply.yaml rename to .github/workflows/apply.yaml.bak diff --git a/application_set.tf b/application_set.tf index 01ebda8..bef8360 100644 --- a/application_set.tf +++ b/application_set.tf @@ -159,3 +159,63 @@ resource "argocd_application_set" "cert_manager" { } } } + +resource "argocd_application_set" "victoria_metrics" { + metadata { + name = "victoriametrics" + } + spec { + generator { + list { + elements = [ + { + cluster = argocd_cluster.dev.name + url = argocd_cluster.dev.server + }, + { + cluster = argocd_cluster.prod.name + url = argocd_cluster.prod.server + } + ] + } + } + template { + metadata { + name = "victoriametrics-{{cluster}}" + labels = { + cluster = "{{cluster}}" + } + } + + spec { + source { + helm { + release_name = "victoriametrics" + value_files = [ + "$values/victoriametrics/{{cluster}}/values.yaml" + ] + } + repo_url = argocd_repository.victoria_metrics.repo + target_revision = "0.x.x" + chart = "victoria-metrics-k8s-stack" + } + source { + repo_url = var.repo_url + target_revision = "HEAD" + ref = "values" + } + + source { + repo_url = var.repo_url + target_revision = "HEAD" + path = "victoriametrics/{{cluster}}" + } + + destination { + server = "{{url}}" + namespace = "guardian" + } + } + } + } +} \ No newline at end of file diff --git a/repository.tf b/repository.tf new file mode 100644 index 0000000..31126ef --- /dev/null +++ b/repository.tf @@ -0,0 +1,5 @@ +resource "argocd_repository" "victoria_metrics" { + repo = "https://victoriametrics.github.io/helm-charts/" + type = "helm" + name = "vm" +} \ No newline at end of file diff --git a/victoriametrics/dev/kustomization.yaml b/victoriametrics/dev/kustomization.yaml new file mode 100644 index 0000000..4ca9d29 --- /dev/null +++ b/victoriametrics/dev/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - additional-scrape-configs.yaml + - svc.yaml \ No newline at end of file diff --git a/victoriametrics/prod/kustomization.yaml b/victoriametrics/prod/kustomization.yaml new file mode 100644 index 0000000..8efdb03 --- /dev/null +++ b/victoriametrics/prod/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - additional-scrape-configs.yaml \ No newline at end of file