Skip to content

Commit

Permalink
feat: add variable to set resources with default values (#76)
Browse files Browse the repository at this point in the history
* feat: add variable to set resources with default values

Having default values is good practice to prevent that our components could eventually starve other workloads on the cluster. However, these should probably be adapted in production clusters and are only a safeguard in case someone forgets to set them.

* docs(terraform-docs): generate docs and write to README.adoc

---------

Co-authored-by: lentidas <lentidas@users.noreply.github.com>
  • Loading branch information
lentidas and lentidas authored Apr 17, 2024
1 parent 210f318 commit ed77f88
Show file tree
Hide file tree
Showing 15 changed files with 419 additions and 59 deletions.
51 changes: 49 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v6.1.1"`
Default: `"v6.2.0"`

==== [[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>

Expand Down Expand Up @@ -123,6 +123,29 @@ Type: `number`

Default: `2`

==== [[input_resources]] <<input_resources,resources>>

Description: Resource limits and requests for Traefik's pods. Follow the style on https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/[official documentation] to understand the format of the values.

IMPORTANT: These are not production values. You should always adjust them to your needs.

Type:
[source,hcl]
----
object({
requests = optional(object({
cpu = optional(string, "150m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
})
----

Default: `{}`

==== [[input_enable_https_redirection]] <<input_enable_https_redirection,enable_https_redirection>>

Description: Enable HTTP to HTTPS redirection on all ingresses.
Expand Down Expand Up @@ -198,7 +221,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`
|`"v6.1.1"`
|`"v6.2.0"`
|no

|[[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>
Expand Down Expand Up @@ -251,6 +274,30 @@ object({
|`2`
|no

|[[input_resources]] <<input_resources,resources>>
|Resource limits and requests for Traefik's pods. Follow the style on https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/[official documentation] to understand the format of the values.

IMPORTANT: These are not production values. You should always adjust them to your needs.

|

[source]
----
object({
requests = optional(object({
cpu = optional(string, "150m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
})
----

|`{}`
|no

|[[input_enable_https_redirection]] <<input_enable_https_redirection,enable_https_redirection>>
|Enable HTTP to HTTPS redirection on all ingresses.
|`bool`
Expand Down
51 changes: 49 additions & 2 deletions aks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v6.1.1"`
Default: `"v6.2.0"`

==== [[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>

Expand Down Expand Up @@ -127,6 +127,29 @@ Type: `number`

Default: `2`

==== [[input_resources]] <<input_resources,resources>>

Description: Resource limits and requests for Traefik's pods. Follow the style on https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/[official documentation] to understand the format of the values.

IMPORTANT: These are not production values. You should always adjust them to your needs.

Type:
[source,hcl]
----
object({
requests = optional(object({
cpu = optional(string, "150m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
})
----

Default: `{}`

==== [[input_enable_https_redirection]] <<input_enable_https_redirection,enable_https_redirection>>

Description: Enable HTTP to HTTPS redirection on all ingresses.
Expand Down Expand Up @@ -200,7 +223,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`
|`"v6.1.1"`
|`"v6.2.0"`
|no

|[[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>
Expand Down Expand Up @@ -253,6 +276,30 @@ object({
|`2`
|no

|[[input_resources]] <<input_resources,resources>>
|Resource limits and requests for Traefik's pods. Follow the style on https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/[official documentation] to understand the format of the values.

IMPORTANT: These are not production values. You should always adjust them to your needs.

|

[source]
----
object({
requests = optional(object({
cpu = optional(string, "150m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
})
----

|`{}`
|no

|[[input_enable_https_redirection]] <<input_enable_https_redirection,enable_https_redirection>>
|Enable HTTP to HTTPS redirection on all ingresses.
|`bool`
Expand Down
15 changes: 9 additions & 6 deletions aks/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
module "traefik" {
source = "../"

argocd_project = var.argocd_project
argocd_labels = var.argocd_labels
destination_cluster = var.destination_cluster
target_revision = var.target_revision
enable_service_monitor = var.enable_service_monitor
app_autosync = var.app_autosync
argocd_project = var.argocd_project
argocd_labels = var.argocd_labels
destination_cluster = var.destination_cluster
target_revision = var.target_revision
enable_service_monitor = var.enable_service_monitor
app_autosync = var.app_autosync

replicas = var.replicas
resources = var.resources
enable_https_redirection = var.enable_https_redirection

helm_values = concat(local.helm_values, var.helm_values)
Expand Down
51 changes: 49 additions & 2 deletions eks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v6.1.1"`
Default: `"v6.2.0"`

==== [[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>

Expand Down Expand Up @@ -111,6 +111,29 @@ Type: `number`

Default: `2`

==== [[input_resources]] <<input_resources,resources>>

Description: Resource limits and requests for Traefik's pods. Follow the style on https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/[official documentation] to understand the format of the values.

IMPORTANT: These are not production values. You should always adjust them to your needs.

Type:
[source,hcl]
----
object({
requests = optional(object({
cpu = optional(string, "150m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
})
----

Default: `{}`

==== [[input_enable_https_redirection]] <<input_enable_https_redirection,enable_https_redirection>>

Description: Enable HTTP to HTTPS redirection on all ingresses.
Expand Down Expand Up @@ -172,7 +195,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`
|`"v6.1.1"`
|`"v6.2.0"`
|no

|[[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>
Expand Down Expand Up @@ -225,6 +248,30 @@ object({
|`2`
|no

|[[input_resources]] <<input_resources,resources>>
|Resource limits and requests for Traefik's pods. Follow the style on https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/[official documentation] to understand the format of the values.

IMPORTANT: These are not production values. You should always adjust them to your needs.

|

[source]
----
object({
requests = optional(object({
cpu = optional(string, "150m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
})
----

|`{}`
|no

|[[input_enable_https_redirection]] <<input_enable_https_redirection,enable_https_redirection>>
|Enable HTTP to HTTPS redirection on all ingresses.
|`bool`
Expand Down
15 changes: 9 additions & 6 deletions eks/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
module "traefik" {
source = "../nodeport/"

argocd_project = var.argocd_project
argocd_labels = var.argocd_labels
destination_cluster = var.destination_cluster
target_revision = var.target_revision
enable_service_monitor = var.enable_service_monitor
app_autosync = var.app_autosync
argocd_project = var.argocd_project
argocd_labels = var.argocd_labels
destination_cluster = var.destination_cluster
target_revision = var.target_revision
enable_service_monitor = var.enable_service_monitor
app_autosync = var.app_autosync

replicas = var.replicas
resources = var.resources
enable_https_redirection = var.enable_https_redirection

helm_values = concat(local.helm_values, var.helm_values)
Expand Down
51 changes: 49 additions & 2 deletions kind/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v6.1.1"`
Default: `"v6.2.0"`

==== [[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>

Expand Down Expand Up @@ -123,6 +123,29 @@ Type: `number`

Default: `2`

==== [[input_resources]] <<input_resources,resources>>

Description: Resource limits and requests for Traefik's pods. Follow the style on https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/[official documentation] to understand the format of the values.

IMPORTANT: These are not production values. You should always adjust them to your needs.

Type:
[source,hcl]
----
object({
requests = optional(object({
cpu = optional(string, "150m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
})
----

Default: `{}`

==== [[input_enable_https_redirection]] <<input_enable_https_redirection,enable_https_redirection>>

Description: Enable HTTP to HTTPS redirection on all ingresses.
Expand Down Expand Up @@ -204,7 +227,7 @@ Description: External IP address of Traefik LB service.
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v6.1.1"`
|`"v6.2.0"`
|no

|[[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>
Expand Down Expand Up @@ -257,6 +280,30 @@ object({
|`2`
|no

|[[input_resources]] <<input_resources,resources>>
|Resource limits and requests for Traefik's pods. Follow the style on https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/[official documentation] to understand the format of the values.

IMPORTANT: These are not production values. You should always adjust them to your needs.

|

[source]
----
object({
requests = optional(object({
cpu = optional(string, "150m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
})
----

|`{}`
|no

|[[input_enable_https_redirection]] <<input_enable_https_redirection,enable_https_redirection>>
|Enable HTTP to HTTPS redirection on all ingresses.
|`bool`
Expand Down
15 changes: 9 additions & 6 deletions kind/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
module "traefik" {
source = "../"

argocd_project = var.argocd_project
argocd_labels = var.argocd_labels
destination_cluster = var.destination_cluster
target_revision = var.target_revision
enable_service_monitor = var.enable_service_monitor
app_autosync = var.app_autosync
argocd_project = var.argocd_project
argocd_labels = var.argocd_labels
destination_cluster = var.destination_cluster
target_revision = var.target_revision
enable_service_monitor = var.enable_service_monitor
app_autosync = var.app_autosync

replicas = var.replicas
resources = var.resources
enable_https_redirection = var.enable_https_redirection

helm_values = concat(local.helm_values, var.helm_values)
Expand Down
Loading

0 comments on commit ed77f88

Please sign in to comment.