Add ArgoCD as an optional module

This commit is contained in:
2024-03-14 17:00:30 +01:00
parent 4f744da328
commit 19da08cb1a
11 changed files with 128 additions and 4 deletions

View File

@@ -0,0 +1,28 @@
resource "helm_release" "argocd" {
namespace = var.namespace
create_namespace = true
name = "argo"
repository = "https://argoproj.github.io/argo-helm"
chart = "argo-cd"
version = var.argocd_chart_version
cleanup_on_fail = true
# Helm chart deployment can sometimes take longer than the default 5 minutes
timeout = var.timeout_seconds
set {
name = "configs.params.server\\.insecure"
value = "true"
}
}
resource "kubectl_manifest" "dashboard-ingress" {
depends_on = [helm_release.argocd]
server_side_apply = true
yaml_body = templatefile("${path.module}/argocd_ingress_route.tfpl.yaml", {
namespace = var.namespace,
my_domain = var.my_domain
})
}

View File

@@ -0,0 +1,24 @@
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: argocd-server
namespace: ${namespace}
spec:
entryPoints:
- websecure
routes:
- kind: Rule
match: Host(`argocd.${my_domain}`)
priority: 10
services:
- name: argo-argocd-server
port: 80
- kind: Rule
match: Host(`argocd.${my_domain}`) && Headers(`Content-Type`, `application/grpc`)
priority: 11
services:
- name: argo-argocd-server
port: 80
scheme: h2c
tls: {}

View File

@@ -0,0 +1,7 @@
output "argocd_url" {
value = "argocd.${var.my_domain}"
}
output "argo_helm_values_overrides" {
value = helm_release.argocd.metadata[0].values
}

View File

@@ -0,0 +1,12 @@
terraform {
required_providers {
helm = {
source = "hashicorp/helm"
version = ">= 2.12.1"
}
kubectl = {
source = "gavinbunney/kubectl"
version = ">= 1.14.0"
}
}
}

View File

@@ -0,0 +1,30 @@
variable "compartment_ocid" {}
variable "environment" {
default = "prod"
}
variable "cluster_ocid" {
type = string
}
variable "namespace" {
description = "Namespace to install argocd chart into"
type = string
default = "argocd"
}
variable "my_domain" {
type = string
}
variable "argocd_chart_version" {
description = "Version of argocd chart to install"
type = string
default = "6.7.1" # See https://artifacthub.io/packages/helm/argo/argo-cd for latest version(s)
}
# Helm chart deployment can sometimes take longer than the default 5 minutes
variable "timeout_seconds" {
type = number
description = "Helm chart deployment can sometimes take longer than the default 5 minutes. Set a custom timeout here."
default = 800 # 10 minutes
}