diff --git a/thanos/README.md b/thanos/README.md index 76eb5b17..64987102 100644 --- a/thanos/README.md +++ b/thanos/README.md @@ -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 diff --git a/thanos/templates/store-deployment.yaml b/thanos/templates/store-deployment.yaml index 0622522c..161219c8 100644 --- a/thanos/templates/store-deployment.yaml +++ b/thanos/templates/store-deployment.yaml @@ -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 }} @@ -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 }} @@ -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 }} diff --git a/thanos/templates/store-relabel-configmap.yaml b/thanos/templates/store-relabel-configmap.yaml new file mode 100644 index 00000000..bce6ccc3 --- /dev/null +++ b/thanos/templates/store-relabel-configmap.yaml @@ -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}} diff --git a/thanos/values.yaml b/thanos/values.yaml index 4367c93b..ead743af 100644 --- a/thanos/values.yaml +++ b/thanos/values.yaml @@ -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.