From e939f4c78983c7f61096214b00b9aa8b66bf8773 Mon Sep 17 00:00:00 2001 From: Steve Hipwell Date: Wed, 6 Dec 2023 12:18:15 +0000 Subject: [PATCH] feat(thanos): Added rule instance label support Signed-off-by: Steve Hipwell --- charts/thanos/CHANGELOG.md | 1 + charts/thanos/README.md | 7 +++++-- charts/thanos/ci/kubeconform.yaml | 2 ++ charts/thanos/templates/rule/statefulset.yaml | 5 ++++- charts/thanos/values.yaml | 1 + 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/charts/thanos/CHANGELOG.md b/charts/thanos/CHANGELOG.md index 1bc2d710..ec8b2312 100644 --- a/charts/thanos/CHANGELOG.md +++ b/charts/thanos/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `compact.deduplication.enabled` value to disable compact deduplication. - Added `compact.deduplication.func` value to set the compact deduplication function. +- Added `rule.instanceLabel` to set the label `thanos-rule` to `/`. ### Changed diff --git a/charts/thanos/README.md b/charts/thanos/README.md index 8d7db93a..d64b649b 100644 --- a/charts/thanos/README.md +++ b/charts/thanos/README.md @@ -21,7 +21,7 @@ helm upgrade --install --namespace default --values ./my-values.yaml my-release The following table lists the configurable parameters of the _Thanos_ chart and their default values. | Parameter | Description | Default | -|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------| +| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `image.repository` | Image repository. | `quay.io/thanos/thanos` | | `image.tag` | Image tag; this will default to `.Chart.AppVersion` if not set (tag can be completely omitted by setting it to `-`) . | | | `image.digest` | Image digest. | | @@ -58,7 +58,9 @@ The following table lists the configurable parameters of the _Thanos_ chart and | `compact.priorityClassName` | Priority class name to use for the compact pod. | `""` | | `compact.terminationGracePeriodSeconds` | Termination grace period for the compact pod. | `null` | | `compact.extraEnv` | Extra environment variables for the _thanos-compact_ container in the compact pod. | `[]` | -| `compact.replicaDeduplication` | If `true`, use the `penalty` deduplication function optimised for HA Prometheus replicas. | `false` | +| `compact.deduplication.enabled` | If `true`, deduplication is enabled for compact. | `true` | +| `compact.deduplication.func` | If specified override the default deduplication function. | `false` | +| `compact.replicaDeduplication` | **DEPRECATED** - If `true`, use the `penalty` deduplication function optimised for HA Prometheus replicas. | | | `compact.extraArgs` | Extra arguments for the _thanos-compact_ container in the compact pod. | `[]` | | `compact.livenessProbe` | Liveness probe for the compact pod. | See _values.yaml_ | | `compact.readinessProbe` | Readiness probe for the compact pod. | See _values.yaml_ | @@ -245,6 +247,7 @@ The following table lists the configurable parameters of the _Thanos_ chart and | `rule.priorityClassName` | Priority class name to use for the rule pod. | `""` | | `rule.terminationGracePeriodSeconds` | Termination grace period for the rule pod. | `null` | | `rule.extraEnv` | Extra environment variables for the _thanos-rule_ container in the rule pod. | `[]` | +| `rule.instanceLabel` | If `true`, add a label for the rule instance. | `false` | | `rule.retention` | Block retention period on local disk (`--tsdb.retention`). | `48h` | | `rule.blockDuration` | Block duration for TSDB block (`--tsdb.block-duration`). | `2h` | | `rule.evalInterval` | Rule evaluation interval (`--eval-interval`). | `1m` | diff --git a/charts/thanos/ci/kubeconform.yaml b/charts/thanos/ci/kubeconform.yaml index 7e65f866..c404e861 100644 --- a/charts/thanos/ci/kubeconform.yaml +++ b/charts/thanos/ci/kubeconform.yaml @@ -186,6 +186,8 @@ rule: - key: system operator: Exists + instanceLabel: true + storeGateway: podDisruptionBudget: enabled: true diff --git a/charts/thanos/templates/rule/statefulset.yaml b/charts/thanos/templates/rule/statefulset.yaml index c237bd4e..91acd448 100644 --- a/charts/thanos/templates/rule/statefulset.yaml +++ b/charts/thanos/templates/rule/statefulset.yaml @@ -76,6 +76,9 @@ spec: - --http-address=0.0.0.0:10902 - --data-dir=/var/thanos/rule - --objstore.config-file=/etc/thanos/objstore.yaml + {{- if .Values.rule.instanceLabel }} + - {{ printf "--label=thanos-rule=\"%s/%s\"" .Release.Namespace (include "thanos.rule.fullname" .) }} + {{- end }} - --label=rule_replica="$(NAME)" - --alert.label-drop=rule_replica {{- if .Values.receive.enabled }} @@ -86,7 +89,7 @@ spec: {{- end }} - --tsdb.retention={{ .Values.rule.retention }} - --tsdb.block-duration={{ .Values.rule.blockDuration }} - - {{ printf "--query=dnssrv+_http._tcp.%s.%s.svc.%s" (include "thanos.query.fullname" .) .Release.Namespace .Values.clusterDomain}} + - {{ printf "--query=dnssrv+_http._tcp.%s.%s.svc.%s" (include "thanos.query.fullname" .) .Release.Namespace .Values.clusterDomain }} - --rule-file=/etc/thanos/rules/*.yaml - --eval-interval={{ .Values.rule.evalInterval }} - --alertmanagers.config-file=/etc/thanos/alertmanagers-config.yaml diff --git a/charts/thanos/values.yaml b/charts/thanos/values.yaml index c42ec84d..697d73d8 100644 --- a/charts/thanos/values.yaml +++ b/charts/thanos/values.yaml @@ -516,6 +516,7 @@ rule: extraEnv: [] + instanceLabel: false retention: 48h blockDuration: 2h evalInterval: 1m