From 2a27233b291be8f3bf054ef50d15a98ad0f6395a Mon Sep 17 00:00:00 2001 From: Lenny Consuegra Date: Wed, 31 Jan 2024 14:43:38 +0100 Subject: [PATCH 1/8] feat: add a subdomain variable --- aks/main.tf | 1 + eks/main.tf | 1 + kind/main.tf | 1 + locals.tf | 14 +++++++------- sks/main.tf | 1 + variables.tf | 6 ++++++ 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/aks/main.tf b/aks/main.tf index ae9bad7b..2ad1bec7 100644 --- a/aks/main.tf +++ b/aks/main.tf @@ -61,6 +61,7 @@ module "thanos" { cluster_name = var.cluster_name base_domain = var.base_domain + subdomain = var.subdomain argocd_project = var.argocd_project argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster diff --git a/eks/main.tf b/eks/main.tf index d638c08a..60cc0ade 100644 --- a/eks/main.tf +++ b/eks/main.tf @@ -3,6 +3,7 @@ module "thanos" { cluster_name = var.cluster_name base_domain = var.base_domain + subdomain = var.subdomain argocd_project = var.argocd_project argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster diff --git a/kind/main.tf b/kind/main.tf index d638c08a..60cc0ade 100644 --- a/kind/main.tf +++ b/kind/main.tf @@ -3,6 +3,7 @@ module "thanos" { cluster_name = var.cluster_name base_domain = var.base_domain + subdomain = var.subdomain argocd_project = var.argocd_project argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster diff --git a/locals.tf b/locals.tf index a8623750..ef247028 100644 --- a/locals.tf +++ b/locals.tf @@ -73,7 +73,7 @@ locals { resources = local.thanos.compactor_resources persistence = { # The Access Mode needs to be set as ReadWriteOnce because AWS Elastic Block storage does not support other - # modes (https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes). + # modes (https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes). # Since the compactor is the only pod accessing this volume, there should be no issue to have this as # ReadWriteOnce (https://stackoverflow.com/a/57799347). accessModes = [ @@ -127,7 +127,7 @@ locals { hostname = "" extraRules = [ { - host = "thanos-bucketweb.apps.${var.base_domain}" + host = "thanos-bucketweb.${trimprefix("${var.subdomain}.${var.base_domain}", ".")}" http = { paths = [ { @@ -168,7 +168,7 @@ locals { extraTls = [{ secretName = "thanos-bucketweb-tls" hosts = [ - "thanos-bucketweb.apps.${var.base_domain}", + "thanos-bucketweb.${trimprefix("${var.subdomain}.${var.base_domain}", ".")}", "${local.thanos.bucketweb_domain}" ] }] @@ -261,7 +261,7 @@ locals { hostname = "" extraRules = [ { - host = "thanos-query.apps.${var.base_domain}" + host = "thanos-query.${trimprefix("${var.subdomain}.${var.base_domain}", ".")}" http = { paths = [ { @@ -302,7 +302,7 @@ locals { extraTls = [{ secretName = "thanos-query-tls" hosts = [ - "thanos-query.apps.${var.base_domain}", + "thanos-query.${trimprefix("${var.subdomain}.${var.base_domain}", ".")}", "${local.thanos.query_domain}" ] }] @@ -316,8 +316,8 @@ locals { }] thanos_defaults = { - query_domain = "thanos-query.apps.${var.cluster_name}.${var.base_domain}" - bucketweb_domain = "thanos-bucketweb.apps.${var.cluster_name}.${var.base_domain}" + query_domain = "thanos-query.${trimprefix("${var.subdomain}.${var.cluster_name}", ".")}.${var.base_domain}" + bucketweb_domain = "thanos-bucketweb.${trimprefix("${var.subdomain}.${var.cluster_name}", ".")}.${var.base_domain}" # TODO Create proper Terraform variables for these values instead of bundling everything inside of these locals diff --git a/sks/main.tf b/sks/main.tf index d638c08a..60cc0ade 100644 --- a/sks/main.tf +++ b/sks/main.tf @@ -3,6 +3,7 @@ module "thanos" { cluster_name = var.cluster_name base_domain = var.base_domain + subdomain = var.subdomain argocd_project = var.argocd_project argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster diff --git a/variables.tf b/variables.tf index 673b44de..9748951e 100644 --- a/variables.tf +++ b/variables.tf @@ -12,6 +12,12 @@ variable "base_domain" { type = string } +variable "subdomain" { + description = "Sub domain of the cluster. Value used for the ingress' URL of the application." + type = string + default = "apps" +} + variable "argocd_project" { description = "Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application." type = string From 0352f8bcf51976463db9646aa6d00f36c5810831 Mon Sep 17 00:00:00 2001 From: lentidas Date: Tue, 20 Feb 2024 09:41:57 +0000 Subject: [PATCH 2/8] docs(terraform-docs): generate docs and write to README.adoc --- README.adoc | 26 ++++++++++++++++++++------ aks/README.adoc | 18 ++++++++++++++++-- eks/README.adoc | 18 ++++++++++++++++-- kind/README.adoc | 18 ++++++++++++++++-- sks/README.adoc | 18 ++++++++++++++++-- 5 files changed, 84 insertions(+), 14 deletions(-) diff --git a/README.adoc b/README.adoc index 567849e8..e93a0c87 100644 --- a/README.adoc +++ b/README.adoc @@ -36,14 +36,14 @@ The following requirements are needed by this module: The following providers are used by this module: -- [[provider_null]] <> (>= 3) - -- [[provider_argocd]] <> (>= 5) - - [[provider_random]] <> (>= 3) - [[provider_utils]] <> (>= 1) +- [[provider_argocd]] <> (>= 5) + +- [[provider_null]] <> (>= 3) + === Resources The following resources are used by this module: @@ -76,6 +76,14 @@ Type: `string` The following input variables are optional (have default values): +==== [[input_subdomain]] <> + +Description: Sub domain of the cluster. Value used for the ingress' URL of the application. + +Type: `string` + +Default: `"apps"` + ==== [[input_argocd_project]] <> Description: Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application. @@ -106,7 +114,7 @@ Description: Override of target revision of the application chart. Type: `string` -Default: `"v3.1.0"` +Default: `"v3.2.0"` ==== [[input_cluster_issuer]] <> @@ -256,6 +264,12 @@ Description: ID to pass other modules in order to refer to this module as a depe |n/a |yes +|[[input_subdomain]] <> +|Sub domain of the cluster. Value used for the ingress' URL of the application. +|`string` +|`"apps"` +|no + |[[input_argocd_project]] <> |Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application. |`string` @@ -277,7 +291,7 @@ Description: ID to pass other modules in order to refer to this module as a depe |[[input_target_revision]] <> |Override of target revision of the application chart. |`string` -|`"v3.1.0"` +|`"v3.2.0"` |no |[[input_cluster_issuer]] <> diff --git a/aks/README.adoc b/aks/README.adoc index 9a0f8695..a857e818 100644 --- a/aks/README.adoc +++ b/aks/README.adoc @@ -280,6 +280,14 @@ Type: `string` The following input variables are optional (have default values): +==== [[input_subdomain]] <> + +Description: Sub domain of the cluster. Value used for the ingress' URL of the application. + +Type: `string` + +Default: `"apps"` + ==== [[input_argocd_project]] <> Description: Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application. @@ -310,7 +318,7 @@ Description: Override of target revision of the application chart. Type: `string` -Default: `"v3.1.0"` +Default: `"v3.2.0"` ==== [[input_cluster_issuer]] <> @@ -483,6 +491,12 @@ object({ |n/a |yes +|[[input_subdomain]] <> +|Sub domain of the cluster. Value used for the ingress' URL of the application. +|`string` +|`"apps"` +|no + |[[input_argocd_project]] <> |Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application. |`string` @@ -504,7 +518,7 @@ object({ |[[input_target_revision]] <> |Override of target revision of the application chart. |`string` -|`"v3.1.0"` +|`"v3.2.0"` |no |[[input_cluster_issuer]] <> diff --git a/eks/README.adoc b/eks/README.adoc index 9fc89d2c..93659b60 100644 --- a/eks/README.adoc +++ b/eks/README.adoc @@ -273,6 +273,14 @@ Type: `string` The following input variables are optional (have default values): +==== [[input_subdomain]] <> + +Description: Sub domain of the cluster. Value used for the ingress' URL of the application. + +Type: `string` + +Default: `"apps"` + ==== [[input_argocd_project]] <> Description: Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application. @@ -303,7 +311,7 @@ Description: Override of target revision of the application chart. Type: `string` -Default: `"v3.1.0"` +Default: `"v3.2.0"` ==== [[input_cluster_issuer]] <> @@ -452,6 +460,12 @@ object({ |n/a |yes +|[[input_subdomain]] <> +|Sub domain of the cluster. Value used for the ingress' URL of the application. +|`string` +|`"apps"` +|no + |[[input_argocd_project]] <> |Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application. |`string` @@ -473,7 +487,7 @@ object({ |[[input_target_revision]] <> |Override of target revision of the application chart. |`string` -|`"v3.1.0"` +|`"v3.2.0"` |no |[[input_cluster_issuer]] <> diff --git a/kind/README.adoc b/kind/README.adoc index 6d27a4f6..2ef6af27 100644 --- a/kind/README.adoc +++ b/kind/README.adoc @@ -207,6 +207,14 @@ Type: `string` The following input variables are optional (have default values): +==== [[input_subdomain]] <> + +Description: Sub domain of the cluster. Value used for the ingress' URL of the application. + +Type: `string` + +Default: `"apps"` + ==== [[input_argocd_project]] <> Description: Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application. @@ -237,7 +245,7 @@ Description: Override of target revision of the application chart. Type: `string` -Default: `"v3.1.0"` +Default: `"v3.2.0"` ==== [[input_cluster_issuer]] <> @@ -388,6 +396,12 @@ object({ |n/a |yes +|[[input_subdomain]] <> +|Sub domain of the cluster. Value used for the ingress' URL of the application. +|`string` +|`"apps"` +|no + |[[input_argocd_project]] <> |Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application. |`string` @@ -409,7 +423,7 @@ object({ |[[input_target_revision]] <> |Override of target revision of the application chart. |`string` -|`"v3.1.0"` +|`"v3.2.0"` |no |[[input_cluster_issuer]] <> diff --git a/sks/README.adoc b/sks/README.adoc index c28d8764..85f48266 100644 --- a/sks/README.adoc +++ b/sks/README.adoc @@ -156,6 +156,14 @@ Type: `string` The following input variables are optional (have default values): +==== [[input_subdomain]] <> + +Description: Sub domain of the cluster. Value used for the ingress' URL of the application. + +Type: `string` + +Default: `"apps"` + ==== [[input_argocd_project]] <> Description: Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application. @@ -186,7 +194,7 @@ Description: Override of target revision of the application chart. Type: `string` -Default: `"v3.1.0"` +Default: `"v3.2.0"` ==== [[input_cluster_issuer]] <> @@ -342,6 +350,12 @@ object({ |n/a |yes +|[[input_subdomain]] <> +|Sub domain of the cluster. Value used for the ingress' URL of the application. +|`string` +|`"apps"` +|no + |[[input_argocd_project]] <> |Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application. |`string` @@ -363,7 +377,7 @@ object({ |[[input_target_revision]] <> |Override of target revision of the application chart. |`string` -|`"v3.1.0"` +|`"v3.2.0"` |no |[[input_cluster_issuer]] <> From fe3edb5a1eedbe377b29b5988c1e036b0896de76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Heleno?= Date: Tue, 20 Feb 2024 16:28:06 +0100 Subject: [PATCH 3/8] docs: fix typo --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index 9748951e..cdfdd6d6 100644 --- a/variables.tf +++ b/variables.tf @@ -13,7 +13,7 @@ variable "base_domain" { } variable "subdomain" { - description = "Sub domain of the cluster. Value used for the ingress' URL of the application." + description = "Subdomain of the cluster. Value used for the ingress' URL of the application." type = string default = "apps" } From a92a2b80a36cafac5ceb194dd0a4d334da7d7342 Mon Sep 17 00:00:00 2001 From: lentidas Date: Tue, 20 Feb 2024 15:28:40 +0000 Subject: [PATCH 4/8] docs(terraform-docs): generate docs and write to README.adoc --- README.adoc | 8 ++++---- aks/README.adoc | 4 ++-- eks/README.adoc | 4 ++-- kind/README.adoc | 4 ++-- sks/README.adoc | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.adoc b/README.adoc index e93a0c87..02e25af5 100644 --- a/README.adoc +++ b/README.adoc @@ -36,14 +36,14 @@ The following requirements are needed by this module: The following providers are used by this module: +- [[provider_null]] <> (>= 3) + - [[provider_random]] <> (>= 3) - [[provider_utils]] <> (>= 1) - [[provider_argocd]] <> (>= 5) -- [[provider_null]] <> (>= 3) - === Resources The following resources are used by this module: @@ -78,7 +78,7 @@ The following input variables are optional (have default values): ==== [[input_subdomain]] <> -Description: Sub domain of the cluster. Value used for the ingress' URL of the application. +Description: Subdomain of the cluster. Value used for the ingress' URL of the application. Type: `string` @@ -265,7 +265,7 @@ Description: ID to pass other modules in order to refer to this module as a depe |yes |[[input_subdomain]] <> -|Sub domain of the cluster. Value used for the ingress' URL of the application. +|Subdomain of the cluster. Value used for the ingress' URL of the application. |`string` |`"apps"` |no diff --git a/aks/README.adoc b/aks/README.adoc index a857e818..fdc54895 100644 --- a/aks/README.adoc +++ b/aks/README.adoc @@ -282,7 +282,7 @@ The following input variables are optional (have default values): ==== [[input_subdomain]] <> -Description: Sub domain of the cluster. Value used for the ingress' URL of the application. +Description: Subdomain of the cluster. Value used for the ingress' URL of the application. Type: `string` @@ -492,7 +492,7 @@ object({ |yes |[[input_subdomain]] <> -|Sub domain of the cluster. Value used for the ingress' URL of the application. +|Subdomain of the cluster. Value used for the ingress' URL of the application. |`string` |`"apps"` |no diff --git a/eks/README.adoc b/eks/README.adoc index 93659b60..241cfa61 100644 --- a/eks/README.adoc +++ b/eks/README.adoc @@ -275,7 +275,7 @@ The following input variables are optional (have default values): ==== [[input_subdomain]] <> -Description: Sub domain of the cluster. Value used for the ingress' URL of the application. +Description: Subdomain of the cluster. Value used for the ingress' URL of the application. Type: `string` @@ -461,7 +461,7 @@ object({ |yes |[[input_subdomain]] <> -|Sub domain of the cluster. Value used for the ingress' URL of the application. +|Subdomain of the cluster. Value used for the ingress' URL of the application. |`string` |`"apps"` |no diff --git a/kind/README.adoc b/kind/README.adoc index 2ef6af27..b8bafead 100644 --- a/kind/README.adoc +++ b/kind/README.adoc @@ -209,7 +209,7 @@ The following input variables are optional (have default values): ==== [[input_subdomain]] <> -Description: Sub domain of the cluster. Value used for the ingress' URL of the application. +Description: Subdomain of the cluster. Value used for the ingress' URL of the application. Type: `string` @@ -397,7 +397,7 @@ object({ |yes |[[input_subdomain]] <> -|Sub domain of the cluster. Value used for the ingress' URL of the application. +|Subdomain of the cluster. Value used for the ingress' URL of the application. |`string` |`"apps"` |no diff --git a/sks/README.adoc b/sks/README.adoc index 85f48266..8243ea99 100644 --- a/sks/README.adoc +++ b/sks/README.adoc @@ -158,7 +158,7 @@ The following input variables are optional (have default values): ==== [[input_subdomain]] <> -Description: Sub domain of the cluster. Value used for the ingress' URL of the application. +Description: Subdomain of the cluster. Value used for the ingress' URL of the application. Type: `string` @@ -351,7 +351,7 @@ object({ |yes |[[input_subdomain]] <> -|Sub domain of the cluster. Value used for the ingress' URL of the application. +|Subdomain of the cluster. Value used for the ingress' URL of the application. |`string` |`"apps"` |no From 2f4ef79b1658f5c78b91d68c68096f9472454df9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Heleno?= Date: Wed, 21 Feb 2024 09:41:55 +0100 Subject: [PATCH 5/8] fix: make subdomain variable non-nullable --- variables.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/variables.tf b/variables.tf index cdfdd6d6..6eae4716 100644 --- a/variables.tf +++ b/variables.tf @@ -16,6 +16,7 @@ variable "subdomain" { description = "Subdomain of the cluster. Value used for the ingress' URL of the application." type = string default = "apps" + nullable = false } variable "argocd_project" { From c49076f2630d3d56617de7ed59a88fea8b78d590 Mon Sep 17 00:00:00 2001 From: lentidas Date: Wed, 21 Feb 2024 08:46:35 +0000 Subject: [PATCH 6/8] docs(terraform-docs): generate docs and write to README.adoc --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index 02e25af5..a2551591 100644 --- a/README.adoc +++ b/README.adoc @@ -227,10 +227,10 @@ Description: ID to pass other modules in order to refer to this module as a depe [cols="a,a",options="header,autowidth"] |=== |Name |Version +|[[provider_null]] <> |>= 3 |[[provider_random]] <> |>= 3 |[[provider_utils]] <> |>= 1 |[[provider_argocd]] <> |>= 5 -|[[provider_null]] <> |>= 3 |=== = Resources From 718deddeeb2b0b82ecf375d2f1601b6d9ad64056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Heleno?= Date: Fri, 23 Feb 2024 10:49:19 +0100 Subject: [PATCH 7/8] fix: remove annotation for the redirection middleware --- locals.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/locals.tf b/locals.tf index ef247028..553b8d8f 100644 --- a/locals.tf +++ b/locals.tf @@ -118,7 +118,6 @@ locals { annotations = { "cert-manager.io/cluster-issuer" = "${var.cluster_issuer}" "traefik.ingress.kubernetes.io/router.entrypoints" = "websecure" - "traefik.ingress.kubernetes.io/router.middlewares" = "traefik-withclustername@kubernetescrd" "traefik.ingress.kubernetes.io/router.tls" = "true" "ingress.kubernetes.io/ssl-redirect" = "true" "kubernetes.io/ingress.allow-http" = "false" From 4f2971c75ac9cadbcfb1a458fc116bf62999f9b5 Mon Sep 17 00:00:00 2001 From: lentidas Date: Fri, 23 Feb 2024 09:51:39 +0000 Subject: [PATCH 8/8] docs(terraform-docs): generate docs and write to README.adoc --- README.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index a2551591..5a372702 100644 --- a/README.adoc +++ b/README.adoc @@ -40,10 +40,10 @@ The following providers are used by this module: - [[provider_random]] <> (>= 3) -- [[provider_utils]] <> (>= 1) - - [[provider_argocd]] <> (>= 5) +- [[provider_utils]] <> (>= 1) + === Resources The following resources are used by this module: