Skip to content

Commit

Permalink
Merge pull request #3 from project-octal/contrib/ekirmayer
Browse files Browse the repository at this point in the history
Contrib/ekirmayer
  • Loading branch information
dylanturn authored Nov 22, 2021
2 parents d0205b5 + 7b8f609 commit 4ead87e
Show file tree
Hide file tree
Showing 22 changed files with 2,735 additions and 84 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ override.tf.json

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

temp/
tests/**/.terraform.lock.hcl
27 changes: 14 additions & 13 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,5 @@ module "argocd" {
| Name | Description |
|------|-------------|
| <a name="output_namespace"></a> [namespace](#output\_namespace) | n/a |
<!-- END_TF_DOCS -->
<!-- END_TF_DOCS -->

11 changes: 7 additions & 4 deletions argocd-config-maps.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ resource "kubernetes_config_map" "argocd_cm" {
}, var.labels)
}
data = {
url = "https://${var.argocd_url}"
"oidc.config" = var.oidc_config != null ? yamlencode(local.oidc_config) : null
"repositories" = yamlencode(var.argocd_repositories),
"repository.credentials" = yamlencode(var.argocd_repository_credentials)
url = "https://${var.argocd_url}"
"oidc.config" = var.oidc_config != null ? yamlencode(local.oidc_config) : null
"repositories" = yamlencode(var.argocd_repositories),
"repository.credentials" = yamlencode(var.argocd_repository_credentials)
"resource.customizations" = templatefile("${path.module}/configuration-files/resource-customizations.yml", {})
}
}



resource "kubernetes_config_map" "argocd_gpg_keys_cm" {
metadata {
name = "argocd-gpg-keys-cm"
Expand Down
4 changes: 2 additions & 2 deletions argocd-dex/dex-deployment.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ resource "kubernetes_deployment" "dex_server" {
# security_context {}
container {
name = "dex"
image = "${var.image_repository}/${var.dex_image}:v${var.dex_version}"
image = "${var.dex_image_repository}/${var.dex_image_name}:v${var.dex_image_tag}"
image_pull_policy = var.image_pull_policy
command = [
"/shared/argocd-util",
Expand All @@ -55,7 +55,7 @@ resource "kubernetes_deployment" "dex_server" {
}
init_container {
name = "copyutil"
image = "${var.image_repository}/${var.argocd_server_image}:v${var.argocd_version}"
image = "${var.argocd_image_repository}/${var.argocd_image_name}:v${var.argocd_image_tag}"
image_pull_policy = var.image_pull_policy
command = [
"cp",
Expand Down
41 changes: 17 additions & 24 deletions argocd-dex/variables-dex.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,33 @@
## General Configuration ##
###########################
variable "namespace" {
type = string
description = "The namespace this ArgoCD deployment will reside in."
}
variable "image_repository" {
type = string
description = "The image repository to use when pulling images."
type = string
}
variable "image_pull_policy" {
type = string
description = "Determines when the image should be pulled prior to starting the container. `Always`: Always pull the image. | `IfNotPresent`: Only pull the image if it does not already exist on the node. | `Never`: Never pull the image"
type = string
}
variable "labels" {
type = map(string)
description = "Extra Kubernetes labels to include with the resources created by this module"
type = map(string)
}
variable "argocd_image_tag" {
type = string
}
variable "argocd_version" {
type = string
description = "The version of ArgoCD to deploy."
default = "1.7.6"
variable "argocd_image_name" {
type = string
}
variable "argocd_server_image" {
type = string
description = "The image to use for the `argocd-server` deployment"
default = "argoproj/argocd"
variable "argocd_image_repository" {
type = string
}

#######################
## Dex Configuration ##
#######################
variable "dex_image" {
type = string
description = ""
variable "dex_image_tag" {
type = string
}
variable "dex_image_name" {
type = string
}
variable "dex_version" {
type = string
description = "The version of the Dex Docker image to deploy."
variable "dex_image_repository" {
type = string
}
52 changes: 31 additions & 21 deletions argocd-main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,30 @@ module "argocd_redis" {
source = "./argocd-redis"

namespace = kubernetes_namespace.argocd_namespace.metadata.0.name
pod_affinity_topology_key = var.pod_affinity_topology_key
enable_ha_redis = var.enable_ha_redis
haproxy_image_name = var.haproxy_image_name
haproxy_image_tag = var.haproxy_image_tag
redis_image_name = var.redis_image_name
redis_image_tag = var.redis_image_tag
image_repository = var.image_repository
image_pull_policy = var.image_pull_policy
labels = local.labels
pod_affinity_topology_key = var.pod_affinity_topology_key

enable_ha_redis = var.enable_ha_redis
haproxy_image_name = var.haproxy_image_name
haproxy_image_tag = var.haproxy_image_tag
haproxy_image_repository = var.haproxy_image_repository
redis_image_name = var.redis_image_name
redis_image_tag = var.redis_image_tag
redis_image_repository = var.redis_image_repository
}

module "argocd_repo_server" {
source = "./argocd-repo-server"

namespace = kubernetes_namespace.argocd_namespace.metadata.0.name
image_tag = var.argocd_image_tag
image_name = var.argocd_image_name
image_repository = var.image_repository
image_pull_policy = var.image_pull_policy
labels = local.labels

image_tag = var.argocd_image_tag
image_name = var.argocd_image_name
image_repository = var.argocd_image_repository

replicas = var.argocd_repo_replicas
redis_address = module.argocd_redis.redis_address
redis_port = module.argocd_redis.redis_port
Expand All @@ -40,12 +43,13 @@ module "argocd_server" {
source = "./argocd-server"

namespace = kubernetes_namespace.argocd_namespace.metadata.0.name
image_tag = var.argocd_image_tag
image_name = var.argocd_image_name
image_repository = var.image_repository
image_pull_policy = var.image_pull_policy
labels = local.labels

image_tag = var.argocd_image_tag
image_name = var.argocd_image_name
image_repository = var.argocd_image_repository

cpu_request = local.argocd_server_requests_cpu
memory_request = local.argocd_server_requests_memory

Expand All @@ -58,29 +62,35 @@ module "argocd_server" {
argocd_url = var.argocd_url
cluster_cert_issuer = var.cluster_cert_issuer
ingress_class = var.ingress_class
enable_ingress = var.enable_ingress
}
module "argocd_application_controller" {
source = "./argocd-application-controller"

namespace = kubernetes_namespace.argocd_namespace.metadata.0.name
argocd_version = var.argocd_image_tag
argocd_image = var.argocd_image_name
image_repository = var.image_repository
image_pull_policy = var.image_pull_policy
labels = local.labels
redis_address = module.argocd_redis.redis_address
redis_port = module.argocd_redis.redis_port

argocd_version = var.argocd_image_tag
argocd_image = var.argocd_image_name
image_repository = var.argocd_image_repository
redis_address = module.argocd_redis.redis_address
redis_port = module.argocd_redis.redis_port
}
module "argocd_dex" {
source = "./argocd-dex"

count = var.enable_dex ? 1 : 0

namespace = kubernetes_namespace.argocd_namespace.metadata.0.name
dex_version = var.dex_image_tag
dex_image = var.dex_image_name
image_repository = var.image_repository
image_pull_policy = var.image_pull_policy
labels = local.labels

argocd_image_tag = var.argocd_image_tag
argocd_image_name = var.argocd_image_name
argocd_image_repository = var.argocd_image_repository
dex_image_tag = var.dex_image_tag
dex_image_name = var.dex_image_name
dex_image_repository = var.dex_image_repository
}

6 changes: 3 additions & 3 deletions argocd-redis/ main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module "argocd_haproxy_ha" {
namespace = var.namespace
image_tag = var.haproxy_image_tag
image_name = var.haproxy_image_name
image_repository = var.image_repository
image_repository = var.haproxy_image_repository
image_pull_policy = var.image_pull_policy
labels = var.labels
pod_affinity_topology_key = var.pod_affinity_topology_key
Expand All @@ -20,7 +20,7 @@ module "argocd_redis_ha" {
namespace = var.namespace
image_tag = var.redis_image_tag
image_name = var.redis_image_name
image_repository = var.image_repository
image_repository = var.redis_image_repository
image_pull_policy = var.image_pull_policy
labels = var.labels
pod_affinity_topology_key = var.pod_affinity_topology_key
Expand All @@ -34,7 +34,7 @@ module "argocd_redis" {
namespace = var.namespace
image_tag = var.redis_image_tag
image_name = var.redis_image_name
image_repository = var.image_repository
image_repository = var.redis_image_repository
image_pull_policy = var.image_pull_policy
labels = var.labels
}
5 changes: 4 additions & 1 deletion argocd-redis/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ variable "haproxy_image_tag" {
variable "haproxy_image_name" {
type = string
}
variable "haproxy_image_repository" {
type = string
}
variable "redis_image_tag" {
type = string
}
variable "redis_image_name" {
type = string
}
variable "image_repository" {
variable "redis_image_repository" {
type = string
}
variable "image_pull_policy" {
Expand Down
4 changes: 3 additions & 1 deletion argocd-server/ingress.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#TODO: This should be replaced with something generic
module "argcd_ingress_route" {
count = var.enable_ingress ? 1 : 0
source = "github.com/project-octal/terraform-octal-ingress-route"

name = var.name
Expand All @@ -20,4 +22,4 @@ module "argcd_ingress_route" {
]
}
]
}
}
4 changes: 4 additions & 0 deletions argocd-server/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@ variable "ingress_class" {
variable "cluster_cert_issuer" {
type = string
description = "The cluster certificate issuer to use when creating a TLS certificate for the ingress"
}

variable "enable_ingress" {
type = bool
}
24 changes: 24 additions & 0 deletions configuration-files/resource-customizations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
argoproj.io/Application:
health.lua: |
hs = {}
hs.status = "Progressing"
hs.message = ""
if obj.status ~= nil then
if obj.status.health ~= nil then
hs.status = obj.status.health.status
if obj.status.health.message ~= nil then
hs.message = obj.status.health.message
end
end
end
return hs
extensions/Ingress:
health.lua: |
hs = {}
hs.status = "Healthy"
return hs
networking.k8s.io/Ingress:
health.lua: |
hs = {}
hs.status = "Healthy"
return hs
Loading

0 comments on commit 4ead87e

Please sign in to comment.