From 7bc2bce7094247f9e37a658b66fd1998a349b1df Mon Sep 17 00:00:00 2001 From: Charlie Nederhoed Date: Wed, 12 Aug 2020 19:07:59 +0200 Subject: [PATCH] [bitnami/thanos]Add option to configure index storegateway (#3400) * Add option to configure index storegateway * Formatting with new line * Fix lint issue. --- bitnami/thanos/Chart.yaml | 2 +- bitnami/thanos/README.md | 2 ++ bitnami/thanos/templates/_helpers.tpl | 21 +++++++++++++++++++ .../templates/storegateway/configmap.yaml | 11 ++++++++++ .../templates/storegateway/statefulset.yaml | 12 +++++++++++ bitnami/thanos/values-production.yaml | 10 +++++++++ bitnami/thanos/values.yaml | 10 +++++++++ 7 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 bitnami/thanos/templates/storegateway/configmap.yaml diff --git a/bitnami/thanos/Chart.yaml b/bitnami/thanos/Chart.yaml index c2f209ec52..48a812d1bf 100644 --- a/bitnami/thanos/Chart.yaml +++ b/bitnami/thanos/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -version: 2.2.0 +version: 2.3.0 appVersion: 0.14.0 description: Thanos is a highly available metrics system that can be added on top of existing Prometheus deployments, providing a global query view across all Prometheus installations. engine: gotpl diff --git a/bitnami/thanos/README.md b/bitnami/thanos/README.md index 362a9ccac6..ecdb63351a 100644 --- a/bitnami/thanos/README.md +++ b/bitnami/thanos/README.md @@ -277,6 +277,8 @@ The following tables lists the configurable parameters of the Thanos chart and t | `storegateway.enabled` | Enable/disable Thanos Store Gateway component | `false` | | `storegateway.logLevel` | Thanos Store Gateway log level | `info` | | `storegateway.extraFlags` | Extra Flags to passed to Thanos Store Gateway | `[]` | +| `storegateway.config` | Thanos Store Gateway cache configuration | `nil` | +| `storegateway.existingConfigmap` | Name of existing ConfigMap with Thanos Store Gateway cache configuration | `nil` | | `storegateway.updateStrategyType` | Statefulset Update Strategy Type | `RollingUpdate` | | `storegateway.replicaCount` | Number of Thanos Store Gateway replicas to deploy | `1` | | `storegateway.affinity` | Affinity for pod assignment | `{}` (evaluated as a template) | diff --git a/bitnami/thanos/templates/_helpers.tpl b/bitnami/thanos/templates/_helpers.tpl index 28ae6ec2ea..ba1f3ab11c 100644 --- a/bitnami/thanos/templates/_helpers.tpl +++ b/bitnami/thanos/templates/_helpers.tpl @@ -206,6 +206,27 @@ Return true if a configmap object should be created {{- end -}} {{- end -}} +{{/* +Return the Thanos storegateway configuration configmap. +*/}} +{{- define "thanos.storegateway.configmapName" -}} +{{- if .Values.storegateway.existingConfigmap -}} + {{- printf "%s" (tpl .Values.storegateway.existingConfigmap $) -}} +{{- else -}} + {{- printf "%s-storegateway-configmap" (include "thanos.fullname" .) -}} +{{- end -}} +{{- end -}} + +{{/* +Return true if a configmap object should be created +*/}} +{{- define "thanos.storegateway.createConfigmap" -}} +{{- if and .Values.storegateway.config (not .Values.storegateway.existingConfigmap) }} + {{- true -}} +{{- else -}} +{{- end -}} +{{- end -}} + {{/* Return the Thanos Compactor pvc name */}} diff --git a/bitnami/thanos/templates/storegateway/configmap.yaml b/bitnami/thanos/templates/storegateway/configmap.yaml new file mode 100644 index 0000000000..68de6adb18 --- /dev/null +++ b/bitnami/thanos/templates/storegateway/configmap.yaml @@ -0,0 +1,11 @@ +{{- if (include "thanos.storegateway.createConfigmap" .) }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "thanos.fullname" . }}-storegateway-configmap + labels: {{- include "thanos.labels" . | nindent 4 }} + app.kubernetes.io/component: storegateway +data: + config.yml: |- + {{- include "thanos.tplValue" (dict "value" .Values.storegateway.config "context" $) | nindent 4 }} +{{ end }} diff --git a/bitnami/thanos/templates/storegateway/statefulset.yaml b/bitnami/thanos/templates/storegateway/statefulset.yaml index c0ce73f6fa..7b5ea2788e 100644 --- a/bitnami/thanos/templates/storegateway/statefulset.yaml +++ b/bitnami/thanos/templates/storegateway/statefulset.yaml @@ -83,6 +83,9 @@ spec: {{- if .Values.bucketCacheConfig }} - --store.caching-bucket.config-file=/conf/bucket-cache.yml {{- end }} + {{- if or .Values.storegateway.config .Values.storegateway.existingConfigmap }} + - --index-cache.config-file=/conf/cache/config.yml + {{- end }} {{- range .Values.storegateway.extraFlags }} - {{ . }} {{- end }} @@ -107,6 +110,10 @@ spec: mountPath: /conf - name: data mountPath: /data + {{- if or .Values.storegateway.config .Values.storegateway.existingConfigmap }} + - name: cache-config + mountPath: /conf/cache + {{- end }} volumes: - name: objstore-config secret: @@ -114,6 +121,11 @@ spec: {{- if .Values.existingObjstoreSecretItems }} items: {{- toYaml .Values.existingObjstoreSecretItems | nindent 14 }} {{- end }} + {{- if or .Values.storegateway.config .Values.storegateway.existingConfigmap }} + - name: cache-config + configMap: + name: {{ include "thanos.storegateway.configmapName" . }} + {{- end }} {{- if and .Values.storegateway.persistence.enabled .Values.storegateway.persistence.existingClaim }} - name: data persistentVolumeClaim: diff --git a/bitnami/thanos/values-production.yaml b/bitnami/thanos/values-production.yaml index 0b785d7091..66f122e897 100644 --- a/bitnami/thanos/values-production.yaml +++ b/bitnami/thanos/values-production.yaml @@ -741,6 +741,16 @@ storegateway: ## extraFlags: [] + ## Store Gateway Cache Configuration + ## Specify content for config.yml + ## + # config: + + ## ConfigMap with Store Gateway Cache Configuration + ## NOTE: This will override storegateway.config + ## + # existingConfigmap: + ## Number of Thanos Store Gateway replicas to deploy ## replicaCount: 1 diff --git a/bitnami/thanos/values.yaml b/bitnami/thanos/values.yaml index 1fc2cd8c19..0141165e51 100644 --- a/bitnami/thanos/values.yaml +++ b/bitnami/thanos/values.yaml @@ -753,6 +753,16 @@ storegateway: ## extraFlags: [] + ## Store Gateway Cache Configuration + ## Specify content for config.yml + ## + # config: + + ## ConfigMap with Store Gateway Cache Configuration + ## NOTE: This will override storegateway.config + ## + # existingConfigmap: + ## Number of Thanos Store Gateway replicas to deploy ## replicaCount: 1