Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a subdomain variable #71

Merged
merged 8 commits into from
Feb 23, 2024
24 changes: 19 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ The following providers are used by this module:

- [[provider_null]] <<provider_null,null>> (>= 3)

- [[provider_argocd]] <<provider_argocd,argocd>> (>= 5)

- [[provider_random]] <<provider_random,random>> (>= 3)

- [[provider_argocd]] <<provider_argocd,argocd>> (>= 5)

- [[provider_utils]] <<provider_utils,utils>> (>= 1)

=== Resources
Expand Down Expand Up @@ -76,6 +76,14 @@ Type: `string`

The following input variables are optional (have default values):

==== [[input_subdomain]] <<input_subdomain,subdomain>>

Description: Subdomain of the cluster. Value used for the ingress' URL of the application.

Type: `string`

Default: `"apps"`

==== [[input_argocd_project]] <<input_argocd_project,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.
Expand Down Expand Up @@ -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]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -219,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]] <<provider_null,null>> |>= 3
|[[provider_random]] <<provider_random,random>> |>= 3
|[[provider_utils]] <<provider_utils,utils>> |>= 1
|[[provider_argocd]] <<provider_argocd,argocd>> |>= 5
|[[provider_null]] <<provider_null,null>> |>= 3
|===

= Resources
Expand Down Expand Up @@ -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]] <<input_subdomain,subdomain>>
|Subdomain of the cluster. Value used for the ingress' URL of the application.
|`string`
|`"apps"`
|no

|[[input_argocd_project]] <<input_argocd_project,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`
Expand All @@ -277,7 +291,7 @@ Description: ID to pass other modules in order to refer to this module as a depe
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v3.1.0"`
|`"v3.2.0"`
|no

|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
18 changes: 16 additions & 2 deletions aks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,14 @@ Type: `string`

The following input variables are optional (have default values):

==== [[input_subdomain]] <<input_subdomain,subdomain>>

Description: Subdomain of the cluster. Value used for the ingress' URL of the application.

Type: `string`

Default: `"apps"`

==== [[input_argocd_project]] <<input_argocd_project,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.
Expand Down Expand Up @@ -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]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -483,6 +491,12 @@ object({
|n/a
|yes

|[[input_subdomain]] <<input_subdomain,subdomain>>
|Subdomain of the cluster. Value used for the ingress' URL of the application.
|`string`
|`"apps"`
|no

|[[input_argocd_project]] <<input_argocd_project,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`
Expand All @@ -504,7 +518,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v3.1.0"`
|`"v3.2.0"`
|no

|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
1 change: 1 addition & 0 deletions aks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions eks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ Type: `string`

The following input variables are optional (have default values):

==== [[input_subdomain]] <<input_subdomain,subdomain>>

Description: Subdomain of the cluster. Value used for the ingress' URL of the application.

Type: `string`

Default: `"apps"`

==== [[input_argocd_project]] <<input_argocd_project,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.
Expand Down Expand Up @@ -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]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -452,6 +460,12 @@ object({
|n/a
|yes

|[[input_subdomain]] <<input_subdomain,subdomain>>
|Subdomain of the cluster. Value used for the ingress' URL of the application.
|`string`
|`"apps"`
|no

|[[input_argocd_project]] <<input_argocd_project,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`
Expand All @@ -473,7 +487,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v3.1.0"`
|`"v3.2.0"`
|no

|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
1 change: 1 addition & 0 deletions eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions kind/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ Type: `string`

The following input variables are optional (have default values):

==== [[input_subdomain]] <<input_subdomain,subdomain>>

Description: Subdomain of the cluster. Value used for the ingress' URL of the application.

Type: `string`

Default: `"apps"`

==== [[input_argocd_project]] <<input_argocd_project,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.
Expand Down Expand Up @@ -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]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -388,6 +396,12 @@ object({
|n/a
|yes

|[[input_subdomain]] <<input_subdomain,subdomain>>
|Subdomain of the cluster. Value used for the ingress' URL of the application.
|`string`
|`"apps"`
|no

|[[input_argocd_project]] <<input_argocd_project,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`
Expand All @@ -409,7 +423,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v3.1.0"`
|`"v3.2.0"`
|no

|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
1 change: 1 addition & 0 deletions kind/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 7 additions & 8 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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"
Expand All @@ -127,7 +126,7 @@ locals {
hostname = ""
extraRules = [
{
host = "thanos-bucketweb.apps.${var.base_domain}"
host = "thanos-bucketweb.${trimprefix("${var.subdomain}.${var.base_domain}", ".")}"
http = {
paths = [
{
Expand Down Expand Up @@ -168,7 +167,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}"
]
}]
Expand Down Expand Up @@ -261,7 +260,7 @@ locals {
hostname = ""
extraRules = [
{
host = "thanos-query.apps.${var.base_domain}"
host = "thanos-query.${trimprefix("${var.subdomain}.${var.base_domain}", ".")}"
http = {
paths = [
{
Expand Down Expand Up @@ -302,7 +301,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}"
]
}]
Expand All @@ -316,8 +315,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

Expand Down
18 changes: 16 additions & 2 deletions sks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ Type: `string`

The following input variables are optional (have default values):

==== [[input_subdomain]] <<input_subdomain,subdomain>>

Description: Subdomain of the cluster. Value used for the ingress' URL of the application.

Type: `string`

Default: `"apps"`

==== [[input_argocd_project]] <<input_argocd_project,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.
Expand Down Expand Up @@ -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]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -342,6 +350,12 @@ object({
|n/a
|yes

|[[input_subdomain]] <<input_subdomain,subdomain>>
|Subdomain of the cluster. Value used for the ingress' URL of the application.
|`string`
|`"apps"`
|no

|[[input_argocd_project]] <<input_argocd_project,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`
Expand All @@ -363,7 +377,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v3.1.0"`
|`"v3.2.0"`
|no

|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
1 change: 1 addition & 0 deletions sks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ variable "base_domain" {
type = string
}

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" {
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
Expand Down