From bbfdb340b6abb9f189fd4b74d9dfed0dbc39c147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Thu, 11 Apr 2024 23:10:31 +0200 Subject: [PATCH 1/3] [kube-prometheus-stack] Thanos Ruler: Add alertDropLabels + additionalConfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- charts/kube-prometheus-stack/Chart.yaml | 2 +- .../templates/thanos-ruler/ruler.yaml | 10 ++++++++++ charts/kube-prometheus-stack/values.yaml | 11 +++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/charts/kube-prometheus-stack/Chart.yaml b/charts/kube-prometheus-stack/Chart.yaml index f8f420fe96ff..29412b88a3f3 100644 --- a/charts/kube-prometheus-stack/Chart.yaml +++ b/charts/kube-prometheus-stack/Chart.yaml @@ -23,7 +23,7 @@ name: kube-prometheus-stack sources: - https://github.com/prometheus-community/helm-charts - https://github.com/prometheus-operator/kube-prometheus -version: 58.0.1 +version: 58.1.0 appVersion: v0.73.0 kubeVersion: ">=1.19.0-0" home: https://github.com/prometheus-operator/kube-prometheus diff --git a/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml b/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml index 4b6b6697ce51..d37d9d077235 100644 --- a/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml +++ b/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml @@ -184,6 +184,16 @@ spec: {{- if .Values.thanosRuler.thanosRulerSpec.volumeMounts }} volumeMounts: {{ toYaml .Values.thanosRuler.thanosRulerSpec.volumeMounts | indent 4 }} +{{- end }} +{{- if .Values.thanosRuler.thanosRulerSpec.alertDropLabels }} + alertDropLabels: +{{ toYaml .Values.thanosRuler.thanosRulerSpec.alertDropLabels | indent 4 }} {{- end }} portName: {{ .Values.thanosRuler.thanosRulerSpec.portName }} +{{- with .Values.thanosRuler.thanosRulerSpec.additionalConfig }} + {{- tpl (toYaml .) $ | nindent 2 }} +{{- end }} +{{- with .Values.thanosRuler.thanosRulerSpec.additionalConfigString }} + {{- tpl . $ | nindent 2 }} +{{- end }} {{- end }} diff --git a/charts/kube-prometheus-stack/values.yaml b/charts/kube-prometheus-stack/values.yaml index 754377dfd349..694ae1e6e030 100644 --- a/charts/kube-prometheus-stack/values.yaml +++ b/charts/kube-prometheus-stack/values.yaml @@ -4453,6 +4453,10 @@ thanosRuler: # access_key: "" # secret_key: "" + ## Labels by name to drop before sending to alertmanager + ## Maps to the --alert.label-drop flag of thanos ruler. + alertDropLabels: [] + ## QueryEndpoints defines Thanos querier endpoints from which to query metrics. ## Maps to the --query flag of thanos ruler. queryEndpoints: [] @@ -4593,6 +4597,13 @@ thanosRuler: ## portName: "web" + ## Additional configuration which is not covered by the properties above. (passed through tpl) + additionalConfig: {} + + ## Additional configuration which is not covered by the properties above. + ## Useful, if you need advanced templating + additionalConfigString: "" + ## ExtraSecret can be used to store various data in an extra secret ## (use it for example to store hashed basic auth credentials) extraSecret: From f25f7ed30a4deb4eaaae57a99cb0c887c924cc81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Thu, 11 Apr 2024 23:57:10 +0200 Subject: [PATCH 2/3] [kube-prometheus-stack] Thanos Ruler: Add tpl to labels and additionalArgs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- .../kube-prometheus-stack/templates/thanos-ruler/ruler.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml b/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml index d37d9d077235..1f59aa78705d 100644 --- a/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml +++ b/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml @@ -39,7 +39,7 @@ spec: {{- end }} {{- if .Values.thanosRuler.thanosRulerSpec.additionalArgs }} additionalArgs: -{{ toYaml .Values.thanosRuler.thanosRulerSpec.additionalArgs | indent 4 }} +{{ tpl (toYaml .Values.thanosRuler.thanosRulerSpec.additionalArgs) $ | indent 4 }} {{- end }} {{- if .Values.thanosRuler.thanosRulerSpec.nodeSelector }} nodeSelector: @@ -123,7 +123,7 @@ spec: {{- end }} {{- if .Values.thanosRuler.thanosRulerSpec.labels }} labels: -{{ toYaml .Values.thanosRuler.thanosRulerSpec.labels | indent 4 }} +{{ tpl (toYaml .Values.thanosRuler.thanosRulerSpec.labels) $ | indent 4 }} {{- end }} {{- if .Values.thanosRuler.thanosRulerSpec.podMetadata }} podMetadata: From 04ac8cf3b17adb821a08d1d38b1dfb7158a901af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Fri, 12 Apr 2024 11:25:08 +0200 Subject: [PATCH 3/3] [kube-prometheus-stack] Thanos Ruler: Support omit externalPrefix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- .../kube-prometheus-stack/templates/thanos-ruler/ruler.yaml | 4 ++-- charts/kube-prometheus-stack/values.yaml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml b/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml index 1f59aa78705d..908d6a45aa42 100644 --- a/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml +++ b/charts/kube-prometheus-stack/templates/thanos-ruler/ruler.yaml @@ -34,8 +34,8 @@ spec: externalPrefix: "{{ tpl .Values.thanosRuler.thanosRulerSpec.externalPrefix . }}" {{- else if and .Values.thanosRuler.ingress.enabled .Values.thanosRuler.ingress.hosts }} externalPrefix: "http://{{ tpl (index .Values.thanosRuler.ingress.hosts 0) . }}{{ .Values.thanosRuler.thanosRulerSpec.routePrefix }}" -{{- else }} - externalPrefix: http://{{ template "kube-prometheus-stack.thanosRuler.name" . }}.{{ template "kube-prometheus-stack.namespace" . }}:{{ .Values.thanosRuler.service.port }} +{{- else if .Values.thanosRuler.thanosRulerSpec.externalPrefixNilUsesHelmValues }} + externalPrefix: "http://{{ template "kube-prometheus-stack.thanosRuler.name" . }}.{{ template "kube-prometheus-stack.namespace" . }}:{{ .Values.thanosRuler.service.port }}" {{- end }} {{- if .Values.thanosRuler.thanosRulerSpec.additionalArgs }} additionalArgs: diff --git a/charts/kube-prometheus-stack/values.yaml b/charts/kube-prometheus-stack/values.yaml index 694ae1e6e030..12649e2adeda 100644 --- a/charts/kube-prometheus-stack/values.yaml +++ b/charts/kube-prometheus-stack/values.yaml @@ -4431,6 +4431,10 @@ thanosRuler: ## externalPrefix: + ## If true, http://{{ template "kube-prometheus-stack.thanosRuler.name" . }}.{{ template "kube-prometheus-stack.namespace" . }}:{{ .Values.thanosRuler.service.port }} + ## will be used as value for externalPrefix + externalPrefixNilUsesHelmValues: true + ## The route prefix ThanosRuler registers HTTP handlers for. This is useful, if using ExternalURL and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, ## but the server serves requests under a different route prefix. For example for use with kubectl proxy. ##