diff --git a/README.md b/README.md index 9d8e381..b6cba42 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ module "monitoring" { | [aws\_subnet\_exporter\_image\_tag](#input\_aws\_subnet\_exporter\_image\_tag) | Tag of the subnet exporter image to use | `string` | `""` | no | | [business\_unit](#input\_business\_unit) | n/a | `string` | `"Platforms"` | no | | [cluster\_domain\_name](#input\_cluster\_domain\_name) | The cluster domain - used by externalDNS and certmanager to create URLs | `any` | n/a | yes | +| [compactor\_existing\_pvc\_claim\_id](#input\_compactor\_existing\_pvc\_claim\_id) | this is an existing pvc that thanos compactor should connect with | `string` | `"disabled"` | no | | [dockerhub\_password](#input\_dockerhub\_password) | DockerHub password - required to avoid hitting Dockerhub API limits in EKS clusters | `string` | `""` | no | | [dockerhub\_username](#input\_dockerhub\_username) | DockerHub username - required to avoid hitting Dockerhub API limits in EKS clusters | `string` | `""` | no | | [eks\_cluster\_name](#input\_eks\_cluster\_name) | n/a | `string` | `"live"` | no | diff --git a/templates/thanos-values.yaml.tpl b/templates/thanos-values.yaml.tpl index 5649b9e..ca4784a 100644 --- a/templates/thanos-values.yaml.tpl +++ b/templates/thanos-values.yaml.tpl @@ -83,10 +83,29 @@ compactor: retentionResolution5m: 180d retentionResolution1h: 365d persistence: + %{ if eq compactor_existing_pvc_claim_id "disabled"} + %{ else ~} + existingClaim: "${compactor_existing_pvc_claim_id}" + %{ endif ~} size: 16000Gi serviceAccount: create: false name: "${prometheus_sa_name}" + tolerations: + - key: "thanos-node" + operator: "Equal" + value: "true" + effect: "NoSchedule" + + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: cloud-platform.justice.gov.uk/thanos-ng + operator: In + values: + - "true" resources: requests: cpu: 1500m diff --git a/thanos.tf b/thanos.tf index 6edab24..546692f 100644 --- a/thanos.tf +++ b/thanos.tf @@ -8,10 +8,11 @@ resource "helm_release" "thanos" { version = "15.0.0" timeout = 900 values = [templatefile("${path.module}/templates/thanos-values.yaml.tpl", { - prometheus_sa_name = local.prometheus_sa_name - enabled_compact = var.enable_thanos_compact - monitoring_aws_role = module.iam_assumable_role_monitoring.this_iam_role_name - clusterName = terraform.workspace + prometheus_sa_name = local.prometheus_sa_name + enabled_compact = var.enable_thanos_compact + monitoring_aws_role = module.iam_assumable_role_monitoring.this_iam_role_name + clusterName = terraform.workspace + compactor_existing_pvc_claim_id = var.compactor_existing_pvc_claim_id })] depends_on = [ diff --git a/variables.tf b/variables.tf index 41c569b..67d57aa 100644 --- a/variables.tf +++ b/variables.tf @@ -139,4 +139,9 @@ variable "aws_subnet_exporter_image_tag" { description = "Tag of the subnet exporter image to use" default = "" type = string -} \ No newline at end of file +} + +variable "compactor_existing_pvc_claim_id" { + description = "this is an existing pvc that thanos compactor should connect with" + default = "disabled" +}