Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: configure Thanos caching #64

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ The following requirements are needed by this module:

The following providers are used by this module:

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

- [[provider_utils]] <<provider_utils,utils>> (>= 1)
- [[provider_null]] <<provider_null,null>> (>= 3)

- [[provider_argocd]] <<provider_argocd,argocd>> (>= 5)

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

- [[provider_utils]] <<provider_utils,utils>> (>= 1)

=== Resources

Expand All @@ -53,6 +53,7 @@ The following resources are used by this module:
- https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.dependencies] (resource)
- https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.this] (resource)
- https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password[random_password.oauth2_cookie_secret] (resource)
- https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password[random_password.redis_password] (resource)
- https://registry.terraform.io/providers/cloudposse/utils/latest/docs/data-sources/deep_merge_yaml[utils_deep_merge_yaml.values] (data source)

=== Required Inputs
Expand Down Expand Up @@ -105,7 +106,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v3.0.0"`
Default: `"v3.0.1"`

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

Expand Down Expand Up @@ -218,6 +219,7 @@ Description: ID to pass other modules in order to refer to this module as a depe
|https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.dependencies] |resource
|https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.this] |resource
|https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password[random_password.oauth2_cookie_secret] |resource
|https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password[random_password.redis_password] |resource
|https://registry.terraform.io/providers/cloudposse/utils/latest/docs/data-sources/deep_merge_yaml[utils_deep_merge_yaml.values] |data source
|===

Expand Down Expand Up @@ -259,7 +261,7 @@ Description: ID to pass other modules in order to refer to this module as a depe
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v3.0.0"`
|`"v3.0.1"`
|no

|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
4 changes: 2 additions & 2 deletions aks/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: `"v3.0.0"`
Default: `"v3.0.1"`

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

Expand Down Expand Up @@ -488,7 +488,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v3.0.0"`
|`"v3.0.1"`
|no

|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
7 changes: 5 additions & 2 deletions charts/thanos/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ dependencies:
- name: thanos
repository: https://charts.bitnami.com/bitnami
version: 12.21.0
digest: sha256:ad7b9683f7aa4aa053b6c4ab8cd3d3cfbdfa77344f1373c609c7c9a8dff5edd8
generated: "2024-01-18T07:03:25.161576564Z"
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 18.4.0
digest: sha256:9e68e1a336132ec1152bb7a4d6d1b556ab13fc5cd54cd5d69ddeaa3f5bbdba30
generated: "2024-02-06T11:45:00.264361878+01:00"
3 changes: 3 additions & 0 deletions charts/thanos/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ dependencies:
- name: thanos
repository: https://charts.bitnami.com/bitnami
version: 12.21.0
- name: "redis"
version: "18.4.0"
repository: "https://charts.bitnami.com/bitnami"
name: thanos
version: "0"
Binary file added charts/thanos/charts/redis-18.4.0.tgz
Binary file not shown.
4 changes: 2 additions & 2 deletions eks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v3.0.0"`
Default: `"v3.0.1"`

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

Expand Down Expand Up @@ -457,7 +457,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v3.0.0"`
|`"v3.0.1"`
|no

|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
4 changes: 2 additions & 2 deletions kind/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v3.0.0"`
Default: `"v3.0.1"`

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

Expand Down Expand Up @@ -393,7 +393,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v3.0.0"`
|`"v3.0.1"`
|no

|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
77 changes: 77 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -12,6 +24,28 @@ 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: "thanos-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 = {
Expand Down Expand Up @@ -137,6 +171,49 @@ locals {
}

queryFrontend = {
extraFlags = [
# Query Frontend response cache config -> https://thanos.io/tip/components/query-frontend.md/#caching
<<-EOT
--query-range.response-cache-config="config":
addr: "thanos-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: "thanos-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
,
]
sidecars = [{
args = concat([
"--http-address=0.0.0.0:9075",
Expand Down
5 changes: 5 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions sks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v3.0.0"`
Default: `"v3.0.1"`

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

Expand Down Expand Up @@ -347,7 +347,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v3.0.0"`
|`"v3.0.1"`
|no

|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down