Configure Argo CD to watch servers/legion/apps/ in will/infrastructure

This commit is contained in:
Will Anderson
2026-03-23 08:00:37 -05:00
parent ef2ae715ee
commit 5231adc3a0
4 changed files with 63 additions and 0 deletions
View File
+3
View File
@@ -0,0 +1,3 @@
# Legion Apps
Argo CD watches this directory. Add Kubernetes manifests or Argo CD Application resources here.
+54
View File
@@ -82,3 +82,57 @@ resource "kubernetes_ingress_v1" "argocd" {
depends_on = [helm_release.argocd, helm_release.cert_manager]
}
# Gitea repo credentials for Argo CD
# Label argocd.argoproj.io/secret-type=repository tells Argo CD to use this as a repo credential
resource "kubernetes_secret" "argocd_gitea_repo" {
metadata {
name = "argocd-repo-gitea-infrastructure"
namespace = kubernetes_namespace.argocd.metadata[0].name
labels = {
"argocd.argoproj.io/secret-type" = "repository"
}
}
data = {
type = "git"
url = "http://10.43.1.53:3000/will/infrastructure.git"
username = "will"
password = var.gitea_api_token
}
depends_on = [helm_release.argocd]
}
# Root application — watches servers/legion/apps/ for app manifests
resource "kubernetes_manifest" "argocd_root_app" {
manifest = {
apiVersion = "argoproj.io/v1alpha1"
kind = "Application"
metadata = {
name = "legion-apps"
namespace = kubernetes_namespace.argocd.metadata[0].name
}
spec = {
project = "default"
source = {
repoURL = "http://10.43.1.53:3000/will/infrastructure.git"
targetRevision = "main"
path = "servers/legion/apps"
}
destination = {
server = "https://kubernetes.default.svc"
namespace = "argocd"
}
syncPolicy = {
automated = {
prune = true
selfHeal = true
}
syncOptions = ["CreateNamespace=true"]
}
}
}
depends_on = [helm_release.argocd, kubernetes_secret.argocd_gitea_repo]
}
+6
View File
@@ -129,3 +129,9 @@ variable "gitea_webhook_secret" {
type = string
sensitive = true
}
variable "gitea_api_token" {
description = "Gitea API token for Argo CD repo access"
type = string
sensitive = true
}