From 71aaa9d9a730f5807728a12c2907a34c634d9b22 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Mon, 8 Jan 2024 20:54:23 +0800 Subject: [PATCH] [prometheus-blackbox-exporter] Support setting extraInitContainers and extraContainers to a string value to enable full templating (#4089) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Support a string value to enable full templating Signed-off-by: Jared Tan * fix(kube-prometheus-stack): re-enable memory working set rule (#4044) This rule was accidentally left out while migrating to the new layout for rules in release 54 Signed-off-by: Jan Jungnickel Signed-off-by: Jared Tan * Update charts/prometheus-blackbox-exporter/Chart.yaml Co-authored-by: André Bauer Signed-off-by: Jared Tan --------- Signed-off-by: Jared Tan Signed-off-by: Jan Jungnickel Co-authored-by: Jan Jungnickel Co-authored-by: MH Co-authored-by: André Bauer --- charts/prometheus-blackbox-exporter/Chart.yaml | 2 +- .../templates/_helpers.tpl | 13 +++++++++++-- charts/prometheus-blackbox-exporter/values.yaml | 15 ++++++++++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/charts/prometheus-blackbox-exporter/Chart.yaml b/charts/prometheus-blackbox-exporter/Chart.yaml index 1192dc1bd2dd..34c04db01e27 100644 --- a/charts/prometheus-blackbox-exporter/Chart.yaml +++ b/charts/prometheus-blackbox-exporter/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 description: Prometheus Blackbox Exporter name: prometheus-blackbox-exporter -version: 8.6.1 +version: 8.7.0 appVersion: v0.24.0 home: https://github.com/prometheus/blackbox_exporter sources: diff --git a/charts/prometheus-blackbox-exporter/templates/_helpers.tpl b/charts/prometheus-blackbox-exporter/templates/_helpers.tpl index 530613b8fd4c..ecd47ec533fb 100644 --- a/charts/prometheus-blackbox-exporter/templates/_helpers.tpl +++ b/charts/prometheus-blackbox-exporter/templates/_helpers.tpl @@ -150,11 +150,20 @@ securityContext: {{- end }} {{- with .Values.extraInitContainers }} initContainers: -{{ toYaml . }} +{{- if kindIs "string" . }} + {{- tpl . $ | nindent 2 }} +{{- else }} + {{- toYaml . | nindent 2 }} +{{- end -}} {{- end }} + containers: {{ with .Values.extraContainers }} - {{- toYaml . }} +{{- if kindIs "string" . }} + {{- tpl . $ }} +{{- else }} + {{- toYaml . }} +{{- end -}} {{- end }} - name: blackbox-exporter image: {{ include "prometheus-blackbox-exporter.image" . }} diff --git a/charts/prometheus-blackbox-exporter/values.yaml b/charts/prometheus-blackbox-exporter/values.yaml index 8606250c7e89..92b27f310a2b 100644 --- a/charts/prometheus-blackbox-exporter/values.yaml +++ b/charts/prometheus-blackbox-exporter/values.yaml @@ -46,9 +46,12 @@ extraVolumeMounts: # mountPath: /etc/ssl/certs/ca-certificates.crt ## Additional InitContainers to initialize the pod -## +## This supports either a structured array or a templatable string extraInitContainers: [] +## This supports either a structured array or a templatable string + +# Array mode extraContainers: [] # - name: oAuth2-proxy # args: @@ -70,6 +73,16 @@ extraContainers: [] # - mountPath: /etc/prometheus/secrets/blackbox-tls # name: secret-blackbox-tls +# String mode +# extraContainers: |- +# - name: oAuth2-proxy +# args: +# - -https-address=:9116 +# - -upstream=http://localhost:9115 +# - -skip-auth-regex=^/metrics +# - -openshift-delegate-urls={"/":{"group":"monitoring.coreos.com","resource":"prometheuses","verb":"get"}} +# image: {{ .Values.global.imageRegistry }}/openshift/oauth-proxy:v1.1.0 + ## Enable pod security policy pspEnabled: true