Skip to content

Commit

Permalink
feat: add variables to set resource requests/limits on plugins (#104)
Browse files Browse the repository at this point in the history
* feat: add variables to set resource requests/limits on repo-server plugins

* 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 committed May 29, 2024
1 parent 68376a5 commit 9f6789e
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 12 deletions.
50 changes: 47 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v4.4.0"`
Default: `"v4.4.1"`

==== [[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -419,6 +419,28 @@ object({
}), {})
}), {})
kustomized_helm_cmp = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string)
}), {})
}), {})
helmfile_cmp = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string)
}), {})
}), {})
server = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
Expand Down Expand Up @@ -674,8 +696,8 @@ Description: Map of extra accounts that were created and their tokens.
|[[provider_jwt]] <<provider_jwt,jwt>> |>= 1.1
|[[provider_time]] <<provider_time,time>> |>= 0.9
|[[provider_random]] <<provider_random,random>> |>= 3
|[[provider_utils]] <<provider_utils,utils>> |>= 1.6
|[[provider_argocd]] <<provider_argocd,argocd>> |>= 5
|[[provider_utils]] <<provider_utils,utils>> |>= 1.6
|===
= Resources
Expand Down Expand Up @@ -731,7 +753,7 @@ Description: Map of extra accounts that were created and their tokens.
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v4.4.0"`
|`"v4.4.1"`
|no
|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down Expand Up @@ -837,6 +859,28 @@ object({
}), {})
}), {})
kustomized_helm_cmp = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string)
}), {})
}), {})
helmfile_cmp = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string)
}), {})
}), {})
server = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
Expand Down
6 changes: 3 additions & 3 deletions bootstrap/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ The following requirements are needed by this module:

The following providers are used by this module:

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

- [[provider_jwt]] <<provider_jwt,jwt>> (>= 1.1)

- [[provider_time]] <<provider_time,time>> (>= 0.9)

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

- [[provider_helm]] <<provider_helm,helm>> (>= 2)

- [[provider_argocd]] <<provider_argocd,argocd>> (>= 6)
Expand Down Expand Up @@ -201,9 +201,9 @@ Description: The Argo CD accounts pipeline tokens.
[cols="a,a",options="header,autowidth"]
|===
|Name |Version
|[[provider_random]] <<provider_random,random>> |>= 3
|[[provider_jwt]] <<provider_jwt,jwt>> |>= 1.1
|[[provider_time]] <<provider_time,time>> |>= 0.9
|[[provider_random]] <<provider_random,random>> |>= 3
|[[provider_helm]] <<provider_helm,helm>> |>= 2
|[[provider_argocd]] <<provider_argocd,argocd>> |>= 6
|[[provider_utils]] <<provider_utils,utils>> |>= 1.6
Expand Down
12 changes: 6 additions & 6 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ locals {
]
# The extra containers of the repo_server pod must have resource requests/limits in order to allow this component
# to autoscale properly.
resources = { # TODO Maybe these resources should be different from the repo_server one.
requests = { for k, v in var.resources.repo_server.requests : k => v if v != null }
limits = { for k, v in var.resources.repo_server.limits : k => v if v != null }
resources = {
requests = { for k, v in var.resources.kustomized_helm_cmp.requests : k => v if v != null }
limits = { for k, v in var.resources.kustomized_helm_cmp.limits : k => v if v != null }
}
},
{
Expand Down Expand Up @@ -111,9 +111,9 @@ locals {
]
# The extra containers of the repo_server pod must have resource requests/limits in order to allow this component
# to autoscale properly.
resources = { # TODO Maybe these resources should be different from the repo_server one.
requests = { for k, v in var.resources.repo_server.requests : k => v if v != null }
limits = { for k, v in var.resources.repo_server.limits : k => v if v != null }
resources = {
requests = { for k, v in var.resources.helmfile_cmp.requests : k => v if v != null }
limits = { for k, v in var.resources.helmfile_cmp.limits : k => v if v != null }
}
}
]
Expand Down
22 changes: 22 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,28 @@ variable "resources" {
}), {})
}), {})

kustomized_helm_cmp = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string)
}), {})
}), {})

helmfile_cmp = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string)
}), {})
}), {})

server = optional(object({
requests = optional(object({
cpu = optional(string, "50m")
Expand Down

0 comments on commit 9f6789e

Please sign in to comment.