Install argocd in high availability if at least three nodes are available

This commit is contained in:
2023-11-03 10:25:03 +01:00
parent 634bd5f272
commit 766de7e9a8
2 changed files with 66 additions and 3 deletions
+51 -3
View File
@@ -1,4 +1,4 @@
resource "null_resource" "install_argocd" { resource "null_resource" "install_setup" {
connection { connection {
host = hcloud_server_network.manager_private[0].ip host = hcloud_server_network.manager_private[0].ip
user = "root" user = "root"
@@ -10,8 +10,56 @@ resource "null_resource" "install_argocd" {
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"helm repo add 2martens https://repo.2martens.de/charts/", "helm repo add 2martens https://repo.2martens.de/charts/",
"helm install 2martens/cluster_setup", "helm install setup 2martens/cluster_setup",
"helm install 2martens/argocd", ]
}
depends_on = [null_resource.join_nodes, hcloud_server.manager]
}
resource "null_resource" "install_argocd_single" {
count = var.number_nodes < 3 ? 1 : 0
connection {
host = hcloud_server_network.manager_private[0].ip
user = "root"
type = "ssh"
private_key = var.terraform_private_ssh_key
timeout = "2m"
}
provisioner "remote-exec" {
inline = [
"helm repo add 2martens https://repo.2martens.de/charts/",
"helm install setup 2martens/cluster_setup",
"helm install argocd 2martens/argocd",
]
}
depends_on = [null_resource.join_nodes, hcloud_server.manager]
}
resource "null_resource" "install_argocd_ha" {
count = var.number_nodes >= 3 ? 1 : 0
connection {
host = hcloud_server_network.manager_private[0].ip
user = "root"
type = "ssh"
private_key = var.terraform_private_ssh_key
timeout = "2m"
}
provisioner "file" {
content = file("${path.module}/templates/argocd-values-ha.yaml")
destination = "/home/terraform/argocd-values-ha.yaml"
}
provisioner "remote-exec" {
inline = [
"helm repo add 2martens https://repo.2martens.de/charts/",
"helm install setup 2martens/cluster_setup",
"helm install argocd 2martens/argocd --values /home/terraform/argocd-values-ha.yaml",
] ]
} }
@@ -0,0 +1,15 @@
argo-cd:
redis-ha:
enabled: true
controller:
replicas: 1
server:
replicas: 2
repoServer:
replicas: 2
applicationSet:
replicas: 2