diff --git a/charts/thanos/Chart.lock b/charts/thanos/Chart.lock index 4fc2d12b..96e41976 100644 --- a/charts/thanos/Chart.lock +++ b/charts/thanos/Chart.lock @@ -2,5 +2,8 @@ dependencies: - name: thanos repository: https://charts.bitnami.com/bitnami version: 12.13.13 -digest: sha256:95f4c32ad1ca0636ba87643dd1e2157aa8c44c7189f090aa7ec1b70aea661405 -generated: "2023-11-03T07:03:17.594517861Z" +- name: redis + repository: https://charts.bitnami.com/bitnami + version: 18.4.0 +digest: sha256:17f83e8fa5ed4acc963cfb471b3f6a73e5f347903ccf1a533fb6400628222d89 +generated: "2023-11-30T17:09:11.837623668+01:00" diff --git a/charts/thanos/Chart.yaml b/charts/thanos/Chart.yaml index f33a28d9..12c21637 100644 --- a/charts/thanos/Chart.yaml +++ b/charts/thanos/Chart.yaml @@ -3,5 +3,8 @@ dependencies: - name: thanos repository: https://charts.bitnami.com/bitnami version: 12.13.13 +- name: "redis" + version: "18.4.0" + repository: "https://charts.bitnami.com/bitnami" name: thanos version: "0" diff --git a/charts/thanos/charts/redis-18.4.0.tgz b/charts/thanos/charts/redis-18.4.0.tgz new file mode 100644 index 00000000..991cded4 Binary files /dev/null and b/charts/thanos/charts/redis-18.4.0.tgz differ diff --git a/locals.tf b/locals.tf index f0aa3b50..decb4fe1 100644 --- a/locals.tf +++ b/locals.tf @@ -4,6 +4,18 @@ locals { # values.yaml translated into HCL structures. # Possible values available here -> https://github.com/bitnami/charts/tree/master/bitnami/thanos/ helm_values = [{ + redis = { + architecture = "standalone" + auth = { + enabled = true + password = random_password.redis_password.result + } + master = { + persistence = { + enabled = false + } + } + } thanos = { storegateway = { @@ -12,9 +24,36 @@ locals { enabled = false } resources = local.thanos.storegateway_resources + extraFlags = [ + # Store Gateway index cache config -> https://thanos.io/tip/components/store.md/#index-cache + <<-EOT +--index-cache.config="config": + addr: "redis-master:6379" + password: ${random_password.redis_password.result} + db: 0 + dial_timeout: 5s + read_timeout: 3s + write_timeout: 3s + max_get_multi_concurrency: 1000 + get_multi_batch_size: 100 + max_set_multi_concurrency: 1000 + set_multi_batch_size: 100 + tls_enabled: false + cache_size: 0 + max_async_buffer_size: 1000000 + max_async_concurrency: 200 + expiration: 2h +"type": "REDIS" + EOT + ] } query = { + extraFlags = [ + "--query.max-concurrent=1", + "--query.max-concurrent-select=1", + "--query.timeout=15m" + ] dnsDiscovery = { enabled = true sidecarsService = "kube-prometheus-stack-thanos-discovery" # Name of the service that exposes thanos-sidecar @@ -137,6 +176,58 @@ locals { } queryFrontend = { + extraFlags = [ + "--query-range.request-downsampled", + "--query-range.split-interval=6h", + "--query-range.max-query-parallelism=4", + "--labels.default-time-range=6h", + "--labels.max-query-parallelism=4", + # Query Frontend response cache config -> https://thanos.io/tip/components/query-frontend.md/#caching + <<-EOT +--query-range.response-cache-config="config": + addr: "redis-master:6379" + password: ${random_password.redis_password.result} + db: 1 + dial_timeout: 5s + read_timeout: 3s + write_timeout: 3s + max_get_multi_concurrency: 1000 + get_multi_batch_size: 100 + max_set_multi_concurrency: 1000 + set_multi_batch_size: 100 + tls_enabled: false + cache_size: 0 + max_async_buffer_size: 1000000 + max_async_concurrency: 200 + expiration: 2h +"type": "REDIS" + EOT + , + <<-EOT +--labels.response-cache-config="config": + addr: "redis-master:6379" + password: ${random_password.redis_password.result} + db: 2 + dial_timeout: 5s + read_timeout: 3s + write_timeout: 3s + max_get_multi_concurrency: 1000 + get_multi_batch_size: 100 + max_set_multi_concurrency: 1000 + set_multi_batch_size: 100 + tls_enabled: false + cache_size: 0 + max_async_buffer_size: 1000000 + max_async_concurrency: 200 + expiration: 2h +"type": "REDIS" + EOT + , + <<-EOT +--query-frontend.downstream-tripper-config="config": + "response_header_timeout": "15m" + EOT + ] sidecars = [{ args = concat([ "--http-address=0.0.0.0:9075", diff --git a/main.tf b/main.tf index b155877f..d4b46dcb 100644 --- a/main.tf +++ b/main.tf @@ -2,6 +2,11 @@ resource "null_resource" "dependencies" { triggers = var.dependency_ids } +resource "random_password" "redis_password" { + length = 16 + special = false +} + resource "argocd_project" "this" { count = var.argocd_project == null ? 1 : 0