Skip to content

Commit

Permalink
feat: add variable to set resources with default values (#87)
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 16, 2024
1 parent 1883660 commit a7a4c6d
Show file tree
Hide file tree
Showing 13 changed files with 823 additions and 14 deletions.
129 changes: 125 additions & 4 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ The following requirements are needed by this module:

The following providers are used by this module:

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

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

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

=== Resources

Expand Down Expand Up @@ -84,7 +84,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v8.0.0"`
Default: `"v8.1.0"`

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

Expand Down Expand Up @@ -142,6 +142,66 @@ Type: `map(string)`

Default: `{}`

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

Description: Resource limits and requests for cert-manager's components. 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({
controller = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
webhook = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
cainjector = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
startupapicheck = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
})
----

Default: `{}`

==== [[input_letsencrypt_issuer_email_main]] <<input_letsencrypt_issuer_email_main,letsencrypt_issuer_email_main>>

Description: E-mail address used to register with Let's Encrypt.
Expand Down Expand Up @@ -251,7 +311,7 @@ Description: List of cluster issuers created by cert-manager.
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v8.0.0"`
|`"v8.1.0"`
|no
|[[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>
Expand Down Expand Up @@ -304,6 +364,67 @@ object({
|`{}`
|no
|[[input_resources]] <<input_resources,resources>>
|Resource limits and requests for cert-manager's components. 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({
controller = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
webhook = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
cainjector = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
startupapicheck = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
})
----
|`{}`
|no
|[[input_letsencrypt_issuer_email_main]] <<input_letsencrypt_issuer_email_main,letsencrypt_issuer_email_main>>
|E-mail address used to register with Let's Encrypt.
|`string`
Expand Down
125 changes: 123 additions & 2 deletions aks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v8.0.0"`
Default: `"v8.1.0"`

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

Expand Down Expand Up @@ -171,6 +171,66 @@ Type: `map(string)`

Default: `{}`

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

Description: Resource limits and requests for cert-manager's components. 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({
controller = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
webhook = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
cainjector = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
startupapicheck = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
})
----

Default: `{}`

==== [[input_letsencrypt_issuer_email_main]] <<input_letsencrypt_issuer_email_main,letsencrypt_issuer_email_main>>

Description: E-mail address used to register with Let's Encrypt.
Expand Down Expand Up @@ -319,7 +379,7 @@ Description: List of cluster issuers created by cert-manager.
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v8.0.0"`
|`"v8.1.0"`
|no

|[[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>
Expand Down Expand Up @@ -372,6 +432,67 @@ object({
|`{}`
|no

|[[input_resources]] <<input_resources,resources>>
|Resource limits and requests for cert-manager's components. 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({
controller = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
webhook = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
cainjector = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
startupapicheck = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "128Mi")
}), {})
}), {})
})
----

|`{}`
|no

|[[input_letsencrypt_issuer_email_main]] <<input_letsencrypt_issuer_email_main,letsencrypt_issuer_email_main>>
|E-mail address used to register with Let's Encrypt.
|`string`
Expand Down
1 change: 1 addition & 0 deletions aks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module "cert-manager" {

helm_values = concat(local.helm_values, var.helm_values)

resources = var.resources
letsencrypt_issuer_email_main = var.letsencrypt_issuer_email

dependency_ids = var.dependency_ids
Expand Down
Loading

0 comments on commit a7a4c6d

Please sign in to comment.