Skip to content

add support for sharding the store by relabel-configs #1233

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions thanos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ These values are just samples, for more fine-tuning please check the values.yaml
| timePartioning | list of min/max time for store partitions. See more details below. Setting this will create mutlipale thanos store deployments based on the number of items in the list | [{min: "", max: ""}] |
| hashPartioning.shards | The number of shared used to partition the blocks based on the hashmod of the blocks. Can not be used with time partitioning | "" |
| initContainers | InitContainers allows injecting specialized containers that run before app containers. This is meant to pre-configure and tune mounted volume permissions. | [] |
| store.relabel_configs | array of relabel-configs to be used in configuring sharding | [] |


### Store time partions
Expand Down
12 changes: 12 additions & 0 deletions thanos/templates/store-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ spec:
source_labels: ["shard"]
regex: {{ $index }}
{{- end }}
{{- if $root.Values.store.relabel_configs }}
- "--selector.relabel-config-file=/var/thanos/relabel-configs/relabel-configs.yaml"
{{- end }}
{{- if $root.Values.store.extraArgs }}
{{ toYaml $root.Values.store.extraArgs | nindent 8 }}
{{- end }}
Expand All @@ -135,6 +138,10 @@ spec:
name: {{ $root.Values.store.certSecretName }}
readOnly: true
{{- end }}
{{- if $root.Values.store.relabel_configs }}
- name: relabel-configs-volume
mountPath: /var/thanos/relabel-configs
{{ end }}
{{- if $root.Values.store.livenessProbe }}
livenessProbe:
{{ toYaml $root.Values.store.livenessProbe | nindent 10 }}
Expand Down Expand Up @@ -170,6 +177,11 @@ spec:
defaultMode: 420
secretName: {{ $root.Values.store.certSecretName }}
{{- end }}
{{- if $root.Values.store.relabel_configs }}
- name: relabel-configs-volume
configMap:
name: {{ include "thanos.componentname" (list $ "store") }}-relabel-configs
{{- end }}
{{- with $root.Values.store.securityContext }}
securityContext: {{ toYaml . | nindent 8 }}
{{- end }}
Expand Down
16 changes: 16 additions & 0 deletions thanos/templates/store-relabel-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{ if .Values.compact.relabel_configs }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "thanos.componentname" (list $ "store") }}-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: store
data:
relabel-configs.yaml: |-
{{- toYaml .Values.compact.relabel_configs | nindent 5}}
{{- end}}
8 changes: 8 additions & 0 deletions thanos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ store:
# shards:
# InitContainers allows injecting specialized containers that run before app containers. This is meant to pre-configure and tune mounted volume permissions.
initContainers: []

#relabel-configs to use for sharding the store
#https://thanos.io/tip/thanos/sharding.md/#relabelling
relabel_configs: []
#- action: drop
# regex: "A"
# source_labels:
# - cluster
query:
enabled: true
# Labels to treat as a replica indicator along which data is deduplicated.
Expand Down