Skip to content

Commit

Permalink
fix(DMVP-3211): Added variables to handle adot resources configs exte…
Browse files Browse the repository at this point in the history
…rnally
  • Loading branch information
viktoryathegreat committed Dec 25, 2023
1 parent 25506e4 commit ffe95b0
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ worker_groups = {
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | AWS Account Id to apply changes into | `string` | `null` | no |
| <a name="input_adot_config"></a> [adot\_config](#input\_adot\_config) | accept\_namespace\_regex defines the list of namespaces from which metrics will be exported, and additional\_metrics defines additional metrics to export. | <pre>object({<br> accept_namespace_regex = optional(string, "(default|kube-system)")<br> additional_metrics = optional(list(string), [])<br> log_group_name = optional(string, "adot")<br> log_retention = optional(number, 14)<br> helm_values = optional(any, null)<br> logging_enable = optional(bool, false)<br> })</pre> | <pre>{<br> "accept_namespace_regex": "(default|kube-system)",<br> "additional_metrics": [],<br> "helm_values": null,<br> "log_group_name": "adot",<br> "log_retention": 14,<br> "logging_enable": false<br>}</pre> | no |
| <a name="input_adot_config"></a> [adot\_config](#input\_adot\_config) | accept\_namespace\_regex defines the list of namespaces from which metrics will be exported, and additional\_metrics defines additional metrics to export. | <pre>object({<br> accept_namespace_regex = optional(string, "(default|kube-system)")<br> additional_metrics = optional(list(string), [])<br> log_group_name = optional(string, "adot")<br> log_retention = optional(number, 14)<br> helm_values = optional(any, null)<br> logging_enable = optional(bool, false)<br> resources = optional({<br> limit = object({<br> cpu = optional(string, "200m")<br> memory = optional(string, "200Mi")<br> })<br> requests = object({<br> cpu = optional(string, "200m")<br> memory = optional(string, "200Mi")<br> })<br> }, {<br> limit = {<br> cpu = "200m"<br> memory = "200Mi"<br> }<br> requests = {<br> cpu = "200m"<br> memory = "200Mi"<br> }<br> })<br> })</pre> | <pre>{<br> "accept_namespace_regex": "(default|kube-system)",<br> "additional_metrics": [],<br> "helm_values": null,<br> "log_group_name": "adot",<br> "log_retention": 14,<br> "logging_enable": false,<br> "resources": {<br> "limit": {<br> "cpu": "200m",<br> "memory": "200Mi"<br> },<br> "requests": {<br> "cpu": "200m",<br> "memory": "200Mi"<br> }<br> }<br>}</pre> | no |
| <a name="input_adot_version"></a> [adot\_version](#input\_adot\_version) | The version of the AWS Distro for OpenTelemetry addon to use. | `string` | `"v0.78.0-eksbuild.1"` | no |
| <a name="input_alarms"></a> [alarms](#input\_alarms) | Alarms enabled by default you need set sns topic name for send alarms for customize alarms threshold use custom\_values | <pre>object({<br> enabled = optional(bool, true)<br> sns_topic = string<br> custom_values = optional(any, {})<br> })</pre> | n/a | yes |
| <a name="input_alb_log_bucket_name"></a> [alb\_log\_bucket\_name](#input\_alb\_log\_bucket\_name) | n/a | `string` | `""` | no |
Expand Down
10 changes: 7 additions & 3 deletions adot.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ module "adot" {
eks_oidc_root_ca_thumbprint = local.eks_oidc_root_ca_thumbprint
oidc_provider_arn = module.eks-cluster[0].oidc_provider_arn
adot_config = var.adot_config
adot_version = var.adot_version
prometheus_metrics = var.prometheus_metrics
region = local.region
# resources_limit_cpu = var.adot_config.resources.limit["cpu"]
# resources_limit_memory = var.adot_config.resources.limit["memory"]
# resources_requests_cpu = var.adot_config.resources.requests["cpu"]
# resources_requests_memory = var.adot_config.resources.requests["memory"]
adot_version = var.adot_version
prometheus_metrics = var.prometheus_metrics
region = local.region
depends_on = [
module.eks-cluster,
helm_release.cert-manager,
Expand Down
2 changes: 1 addition & 1 deletion examples/spot-instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.67.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.41 |

## Modules

Expand Down
4 changes: 4 additions & 0 deletions modules/adot/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ resource "helm_release" "adot-collector" {
metrics_namespace_specific = local.merged_namespace_specific
prometheus_metrics = var.prometheus_metrics
namespace = var.namespace
resources_limit_cpu = var.adot_config.resources.limit["cpu"]
resources_limit_memory = var.adot_config.resources.limit["memory"]
resources_requests_cpu = var.adot_config.resources.requests["cpu"]
resources_requests_memory = var.adot_config.resources.requests["memory"]
})
]

Expand Down
7 changes: 7 additions & 0 deletions modules/adot/templates/adot-values.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ adotCollector:
name: "adot-collector"
service:
create: true
resources:
limits:
cpu: ${resources_limit_cpu}
memory: ${resources_limit_memory}
requests:
cpu: ${resources_requests_cpu}
memory: ${resources_requests_memory}
adotConfig:
extensions:
health_check: {}
Expand Down
4 changes: 2 additions & 2 deletions modules/adot/tests/template_file/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.63.0 |
| <a name="provider_helm"></a> [helm](#provider\_helm) | 2.9.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.41 |
| <a name="provider_helm"></a> [helm](#provider\_helm) | >= 2.0 |
| <a name="provider_test"></a> [test](#provider\_test) | n/a |

## Modules
Expand Down
24 changes: 24 additions & 0 deletions modules/adot/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,27 @@ variable "adot_log_group_name" {
type = string
default = "adot_log_group_name"
}

# variable "resources" {
# type = object({
# limit = object({
# cpu = optional(string, "200m")
# memory = optional(string, "200Mi")
# })
# requests = object({
# cpu = optional(string, "200m")
# memory = optional(string, "200Mi")
# })
# })
# description = "description"
# default = {
# limit = {
# cpu = "200m"
# memory = "200Mi"
# }
# requests = {
# cpu = "200m"
# memory = "200Mi"
# }
# }
# }
29 changes: 29 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,25 @@ variable "adot_config" {
log_retention = optional(number, 14)
helm_values = optional(any, null)
logging_enable = optional(bool, false)
resources = optional({
limit = object({
cpu = optional(string, "200m")
memory = optional(string, "200Mi")
})
requests = object({
cpu = optional(string, "200m")
memory = optional(string, "200Mi")
})
}, {
limit = {
cpu = "200m"
memory = "200Mi"
}
requests = {
cpu = "200m"
memory = "200Mi"
}
})
})
default = {
accept_namespace_regex = "(default|kube-system)"
Expand All @@ -327,6 +346,16 @@ variable "adot_config" {
log_retention = 14
logging_enable = false
helm_values = null
resources = {
limit = {
cpu = "200m"
memory = "200Mi"
}
requests = {
cpu = "200m"
memory = "200Mi"
}
}
}
}

Expand Down

0 comments on commit ffe95b0

Please sign in to comment.