From 1bd4b08ba9037c427abcd4da888322c4963e3269 Mon Sep 17 00:00:00 2001 From: "alan.eugenio" Date: Wed, 24 Mar 2021 11:53:36 -0700 Subject: [PATCH 1/5] add support for sharding the compactor by relabel-configs --- thanos/Chart.yaml | 2 +- thanos/templates/compact-deployment.yaml | 14 +++++++++++++- thanos/templates/compact-relabel-configmap.yaml | 16 ++++++++++++++++ thanos/values.yaml | 4 ++++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 thanos/templates/compact-relabel-configmap.yaml diff --git a/thanos/Chart.yaml b/thanos/Chart.yaml index 663d1b35..28690706 100644 --- a/thanos/Chart.yaml +++ b/thanos/Chart.yaml @@ -9,7 +9,7 @@ keywords: sources: - https://github.com/thanos-io/thanos - https://github.com/banzaicloud/banzai-charts/tree/master/thanos -version: 0.4.2 +version: 0.4.3 icon: https://raw.githubusercontent.com/thanos-io/thanos/master/docs/img/Thanos-logo_fullmedium.png maintainers: - name: Banzai Cloud diff --git a/thanos/templates/compact-deployment.yaml b/thanos/templates/compact-deployment.yaml index ce86cbf5..7fd5260f 100644 --- a/thanos/templates/compact-deployment.yaml +++ b/thanos/templates/compact-deployment.yaml @@ -61,6 +61,9 @@ spec: - "--retention.resolution-1h={{ .Values.compact.retentionResolution1h }}" - "--block-sync-concurrency={{ .Values.compact.blockSyncConcurrency }}" - "--compact.concurrency={{ .Values.compact.compactConcurrency }}" + {{- if .Values.compact.relabel_configs }} + - "--selector.relabel-config-file=/var/thanos/relabel-configs/relabel-configs.yaml" + {{- end }} - "--wait" {{ with .Values.compact.extraArgs }}{{ toYaml . | indent 8 }}{{- end }} ports: @@ -72,7 +75,11 @@ spec: readOnly: true - name: data-volume mountPath: /var/thanos/compact - resources: {{ toYaml .Values.compact.resources | nindent 10 }} + {{- if .Values.compact.relabel_configs }} + - name: relabel-configs-volume + mountPath: /var/thanos/relabel-configs + {{ end }} + resources: {{ toYaml .Values.compact.resources | nindent 10 }} volumes: - name: data-volume {{- if .Values.compact.dataVolume.backend }} @@ -87,6 +94,11 @@ spec: {{- else }} secretName: {{ include "thanos.fullname" . }} {{- end }} + {{- if .Values.compact.relabel_configs }} + - name: relabel-configs-volume + configMap: + name: {{ include "thanos.componentname" (list $ "compact") }}-relabel-configs + {{- end }} {{- with .Values.compact.securityContext }} securityContext: {{ toYaml . | nindent 8 }} {{- end }} diff --git a/thanos/templates/compact-relabel-configmap.yaml b/thanos/templates/compact-relabel-configmap.yaml new file mode 100644 index 00000000..3de07758 --- /dev/null +++ b/thanos/templates/compact-relabel-configmap.yaml @@ -0,0 +1,16 @@ +{{ if .Values.compact.relabel_configs }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "thanos.componentname" (list $ "compact") }}-relabel-configs + labels: + app.kubernetes.io/name: {{ include "thanos.name" . }} + helm.sh/chart: {{ include "thanos.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + app.kubernetes.io/component: compact +data: + relabel-configs.yaml: |- + {{- toYaml .Values.compact.relabel_configs | nindent 5}} +{{- end}} \ No newline at end of file diff --git a/thanos/values.yaml b/thanos/values.yaml index 4367c93b..3e46ffc3 100644 --- a/thanos/values.yaml +++ b/thanos/values.yaml @@ -711,6 +711,10 @@ compact: # Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity affinity: {} + #relael-configs to use for sharding the compactor + #https://thanos.io/tip/components/compact.md/#flags + relabel-configs: [] + bucket: enabled: true # Number of replicas running from bucket component From 10b12f37b304da29173411b77c7f43af7fbaa492 Mon Sep 17 00:00:00 2001 From: "alan.eugenio" Date: Wed, 24 Mar 2021 11:56:01 -0700 Subject: [PATCH 2/5] added doc ref --- thanos/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/thanos/values.yaml b/thanos/values.yaml index 3e46ffc3..20e5986d 100644 --- a/thanos/values.yaml +++ b/thanos/values.yaml @@ -713,6 +713,7 @@ compact: #relael-configs to use for sharding the compactor #https://thanos.io/tip/components/compact.md/#flags + #https://thanos.io/tip/thanos/sharding.md/#relabelling relabel-configs: [] bucket: From 0c57363b6bec06663bdd695a19ad62598ff10b37 Mon Sep 17 00:00:00 2001 From: "alan.eugenio" Date: Wed, 24 Mar 2021 12:15:20 -0700 Subject: [PATCH 3/5] fixed whitespace --- thanos/templates/compact-deployment.yaml | 2 +- thanos/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/thanos/templates/compact-deployment.yaml b/thanos/templates/compact-deployment.yaml index 7fd5260f..4e3a5aec 100644 --- a/thanos/templates/compact-deployment.yaml +++ b/thanos/templates/compact-deployment.yaml @@ -79,7 +79,7 @@ spec: - name: relabel-configs-volume mountPath: /var/thanos/relabel-configs {{ end }} - resources: {{ toYaml .Values.compact.resources | nindent 10 }} + resources: {{ toYaml .Values.compact.resources | nindent 10 }} volumes: - name: data-volume {{- if .Values.compact.dataVolume.backend }} diff --git a/thanos/values.yaml b/thanos/values.yaml index 20e5986d..8d101292 100644 --- a/thanos/values.yaml +++ b/thanos/values.yaml @@ -714,7 +714,7 @@ compact: #relael-configs to use for sharding the compactor #https://thanos.io/tip/components/compact.md/#flags #https://thanos.io/tip/thanos/sharding.md/#relabelling - relabel-configs: [] + relabel_configs: [] bucket: enabled: true From 76b65a7b1b773b07219f7d783da66ce8336f6cb0 Mon Sep 17 00:00:00 2001 From: alan eugenio Date: Wed, 24 Mar 2021 15:14:50 -0700 Subject: [PATCH 4/5] add newline --- thanos/templates/compact-relabel-configmap.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thanos/templates/compact-relabel-configmap.yaml b/thanos/templates/compact-relabel-configmap.yaml index 3de07758..05356266 100644 --- a/thanos/templates/compact-relabel-configmap.yaml +++ b/thanos/templates/compact-relabel-configmap.yaml @@ -13,4 +13,4 @@ metadata: data: relabel-configs.yaml: |- {{- toYaml .Values.compact.relabel_configs | nindent 5}} -{{- end}} \ No newline at end of file +{{- end}} From eab23b9e948de4d7a20180e3d8674c89d5bbb233 Mon Sep 17 00:00:00 2001 From: "alan.eugenio" Date: Wed, 24 Mar 2021 15:23:32 -0700 Subject: [PATCH 5/5] updated docs --- thanos/README.md | 3 +++ thanos/values.yaml | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/thanos/README.md b/thanos/README.md index 76eb5b17..dbd1b8a9 100644 --- a/thanos/README.md +++ b/thanos/README.md @@ -305,6 +305,9 @@ timePartioning: | compact.compactConcurrency | Number of goroutines to use when compacting groups. | 1 | | compact.dataVolume.backend | Data volume for the compactor to store temporary data defaults to emptyDir. | {} | | compact.persistentVolumeClaim | Create the specified persistentVolumeClaim in case persistentVolumeClaim is used for the dataVolume.backend above and needs to be created. | {} | +| compact.relabel_configs | array of relabel-configs to be used in configuring sharding | [] | + + ## Bucket diff --git a/thanos/values.yaml b/thanos/values.yaml index 8d101292..685e73b7 100644 --- a/thanos/values.yaml +++ b/thanos/values.yaml @@ -711,10 +711,14 @@ compact: # Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity affinity: {} - #relael-configs to use for sharding the compactor + #relabel-configs to use for sharding the compactor #https://thanos.io/tip/components/compact.md/#flags #https://thanos.io/tip/thanos/sharding.md/#relabelling relabel_configs: [] + #- action: drop + # regex: "A" + # source_labels: + # - cluster bucket: enabled: true