Skip to content

Commit

Permalink
Update modules with more input vars
Browse files Browse the repository at this point in the history
  • Loading branch information
nikoshet committed Jan 10, 2025
1 parent 1d201ef commit dc493b1
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 1 deletion.
10 changes: 10 additions & 0 deletions cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ module "<REGION>-<CLUSTER_NAME>" {
providers = {
kubernetes = kubernetes.<PROVIDER_ALIAS>
}
# If you want to set explicitly the NodeSelector for the OpenTelemetry Collector or the kube-state-metrics deployment, you can do so by setting the `otel_node_selector` and `kube_state_node_selector` variables:
# otel_node_selector = {
# purpose = high-availability-node
# }
# kube_state_node_selector = {
# purpose = high-availability-node
# }
}
```

Expand All @@ -69,6 +77,8 @@ module "<REGION>-<CLUSTER_NAME>" {
| otel\_env | Environment variables to set for the OpenTelemetry Collector | `map(string)` | `{}` | no |
| otel\_memory\_limiter | Configuration for the memory limiter processor | <pre>object({<br> check_interval = string<br> limit_percentage = number<br> spike_limit_percentage = number<br> })</pre> | <pre>{<br> "check_interval": "1s",<br> "limit_percentage": 70,<br> "spike_limit_percentage": 30<br>}</pre> | no |
| otel\_resources | Resources to set for the OpenTelemetry Collector container | <pre>object({<br> requests = object({<br> cpu = optional(string)<br> memory = optional(string)<br> })<br> limits = object({<br> cpu = optional(string)<br> memory = optional(string)<br> })<br> })</pre> | <pre>{}</pre> | no |
| kube\_state\_node\_selector | Node Selector for the kube-state-metrics deployment | `map(string)` | `{}` | no |
| otel\_node\_selector | Node Selector for the otel OpenTelemetry Collector deployment | `map(string)` | `{}` | no |

## Outputs

Expand Down
4 changes: 4 additions & 0 deletions cluster/k8s.tf
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ resource "kubernetes_deployment" "kube_state_metrics" {
}
}

node_selector = try(var.kube_state_node_selector, null)

}
}
}
Expand Down Expand Up @@ -559,6 +561,8 @@ resource "kubernetes_deployment" "collector" {
}
}

node_selector = try(var.otel_node_selector, null)

}
}
}
Expand Down
10 changes: 10 additions & 0 deletions cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,13 @@ variable "otel_tolerations" {

default = []
}

variable "otel_node_selector" {
type = map(string)
default = null
}

variable "kube_state_node_selector" {
type = map(string)
default = null
}
7 changes: 6 additions & 1 deletion region-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ It needs to be created only _once_ per AWS account _and_ region.
```hcl
module "<REGION_NAME>-base" {
source = "git::https://github.com/doitintl/terraform-eks-lens.git//region-base"
# If you need to set specific tags on you S3 bucket, you can do so by setting the `s3_tags` variable:
# s3_tags = {
# <key> = <value>
# }
}
```

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| | | | | |
| s3\_tags | Map of tags to assign to the bucket | `map(string)` | `{}` | no |

## Outputs

Expand Down
2 changes: 2 additions & 0 deletions region-base/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ locals {
resource "aws_s3_bucket" "doit_eks_lens" {
bucket = "doitintl-eks-metrics-${local.account_id}-${local.region}"
force_destroy = true

tags = merge({}, var.s3_tags)
}

resource "aws_s3_bucket_lifecycle_configuration" "doit_eks_lens" {
Expand Down
6 changes: 6 additions & 0 deletions region-base/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ variable "permissions_boundary" {
description = "If provided, all IAM roles will be created with this permissions boundary attached."
default = ""
}

variable "s3_tags" {
type = map(string)
description = "Tags to apply to the S3 bucket"
default = {}
}

0 comments on commit dc493b1

Please sign in to comment.