diff --git a/charts/prometheus-blackbox-exporter/Chart.yaml b/charts/prometheus-blackbox-exporter/Chart.yaml index 7e428d6d79e6..6c771df86310 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.8.0 +version: 8.9.0 appVersion: v0.24.0 home: https://github.com/prometheus/blackbox_exporter sources: diff --git a/charts/prometheus-blackbox-exporter/ci/config-reloader-values.yaml b/charts/prometheus-blackbox-exporter/ci/config-reloader-values.yaml new file mode 100644 index 000000000000..ecf72c0452e6 --- /dev/null +++ b/charts/prometheus-blackbox-exporter/ci/config-reloader-values.yaml @@ -0,0 +1,2 @@ +configReloader: + enabled: true diff --git a/charts/prometheus-blackbox-exporter/templates/_helpers.tpl b/charts/prometheus-blackbox-exporter/templates/_helpers.tpl index c31d8772fff0..7eab07ff31d8 100644 --- a/charts/prometheus-blackbox-exporter/templates/_helpers.tpl +++ b/charts/prometheus-blackbox-exporter/templates/_helpers.tpl @@ -102,6 +102,15 @@ The image to use {{- with .Values.image.digest -}}@{{ .}}{{- end -}} {{- end -}} +{{/* +The image to use +*/}} +{{- define "prometheus-blackbox-exporter.config-reloader.image" -}} +{{- with (.Values.global.imageRegistry | default .Values.configReloader.image.registry) -}}{{ . }}/{{- end }} +{{- .Values.configReloader.image.repository -}}:{{- .Values.configReloader.image.tag -}} +{{- with .Values.configReloader.image.digest -}}@{{ .}}{{- end -}} +{{- end -}} + {{/* Define pod spec to be reused by highlevel resources (deployment, daemonset) */}} @@ -165,6 +174,38 @@ containers: {{- toYaml . }} {{- end -}} {{- end }} + +{{- if .Values.configReloader.enabled }} +- name: config-reloader + image: {{ include "prometheus-blackbox-exporter.config-reloader.image" . }} + imagePullPolicy: {{ .Values.configReloader.image.pullPolicy }} + args: + - --config-file={{ .Values.configPath | default "/config/blackbox.yaml" }} + - --watch-interval={{ .Values.configReloader.config.watchInterval }} + - --reload-url=http://127.0.0.1:{{ .Values.containerPort }}/-/reload + - --listen-address=:{{ .Values.configReloader.containerPort }} + - --log-format={{ .Values.configReloader.config.logFormat }} + - --log-level={{ .Values.configReloader.config.logLevel }} + {{- with .Values.resources }} + resources: +{{- toYaml . | nindent 4 }} + {{- end }} + ports: + - name: reloader-web + containerPort: {{ .Values.configReloader.containerPort }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.configReloader.livenessProbe | nindent 4 }} + readinessProbe: + {{- toYaml .Values.configReloader.readinessProbe | nindent 4 }} + volumeMounts: + - mountPath: /config + name: config + {{- with .Values.configReloader.securityContext }} + securityContext: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} - name: blackbox-exporter image: {{ include "prometheus-blackbox-exporter.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} diff --git a/charts/prometheus-blackbox-exporter/templates/daemonset.yaml b/charts/prometheus-blackbox-exporter/templates/daemonset.yaml index 513a9d1da9cb..3e5e538946e0 100644 --- a/charts/prometheus-blackbox-exporter/templates/daemonset.yaml +++ b/charts/prometheus-blackbox-exporter/templates/daemonset.yaml @@ -17,11 +17,15 @@ spec: {{- if .Values.pod.labels }} {{ toYaml .Values.pod.labels | indent 8 }} {{- end }} + {{- if or (not .Values.configReloader.enabled) .Values.podAnnotations }} annotations: + {{- if not .Values.configReloader.enabled }} checksum/config: {{ toYaml .Values.config | sha256sum }} + {{- end }} {{- if .Values.podAnnotations }} {{ toYaml .Values.podAnnotations | indent 8 }} {{- end }} + {{- end }} spec: {{- include "prometheus-blackbox-exporter.podSpec" . | nindent 6 }} {{- end }} diff --git a/charts/prometheus-blackbox-exporter/templates/deployment.yaml b/charts/prometheus-blackbox-exporter/templates/deployment.yaml index 2620e994cd71..68d10a08d5bb 100644 --- a/charts/prometheus-blackbox-exporter/templates/deployment.yaml +++ b/charts/prometheus-blackbox-exporter/templates/deployment.yaml @@ -20,11 +20,15 @@ spec: {{- if .Values.pod.labels }} {{ toYaml .Values.pod.labels | indent 8 }} {{- end }} + {{- if or (not .Values.configReloader.enabled) .Values.podAnnotations }} annotations: + {{- if not .Values.configReloader.enabled }} checksum/config: {{ toYaml .Values.config | sha256sum }} + {{- end }} {{- if .Values.podAnnotations }} {{ toYaml .Values.podAnnotations | indent 8 }} {{- end }} + {{- end }} spec: {{- include "prometheus-blackbox-exporter.podSpec" . | nindent 6 }} {{- end }} diff --git a/charts/prometheus-blackbox-exporter/templates/selfservicemonitor.yaml b/charts/prometheus-blackbox-exporter/templates/selfservicemonitor.yaml index 9ea4c64474aa..56ec3030a259 100644 --- a/charts/prometheus-blackbox-exporter/templates/selfservicemonitor.yaml +++ b/charts/prometheus-blackbox-exporter/templates/selfservicemonitor.yaml @@ -16,11 +16,20 @@ spec: interval: {{ .Values.serviceMonitor.selfMonitor.interval }} scrapeTimeout: {{ .Values.serviceMonitor.selfMonitor.scrapeTimeout }} scheme: http - -{{- if .Values.serviceMonitor.selfMonitor.additionalRelabeling }} + {{- if .Values.serviceMonitor.selfMonitor.additionalRelabeling }} relabelings: -{{ toYaml .Values.serviceMonitor.selfMonitor.additionalRelabeling | indent 6 }} -{{- end }} + {{- toYaml .Values.serviceMonitor.selfMonitor.additionalRelabeling | nindent 6 }} + {{- end }} + {{- if .Values.configReloader.enabled }} + - path: {{ .Values.configReloader.serviceMonitor.selfMonitor.path }} + interval: {{ .Values.configReloader.serviceMonitor.selfMonitor.interval }} + scrapeTimeout: {{ .Values.configReloader.serviceMonitor.selfMonitor.scrapeTimeout }} + scheme: http + {{- if .Values.configReloader.serviceMonitor.selfMonitor.additionalRelabeling }} + relabelings: + {{- toYaml .Values.configReloader.serviceMonitor.selfMonitor.additionalRelabeling | indent 6 }} + {{- end }} + {{- end }} jobLabel: "{{ .Release.Name }}" selector: matchLabels: @@ -28,4 +37,5 @@ spec: namespaceSelector: matchNames: - {{ template "prometheus-blackbox-exporter.namespace" $ }} + {{- end }} diff --git a/charts/prometheus-blackbox-exporter/templates/service.yaml b/charts/prometheus-blackbox-exporter/templates/service.yaml index 7435045eb76b..598efa366402 100644 --- a/charts/prometheus-blackbox-exporter/templates/service.yaml +++ b/charts/prometheus-blackbox-exporter/templates/service.yaml @@ -23,6 +23,12 @@ spec: targetPort: http protocol: TCP name: http + {{ if .Values.configReloader.enabled }} + - port: {{ .Values.configReloader.service.port }} + targetPort: reloader-web + protocol: TCP + name: reloader-web + {{- end }} {{- if .Values.service.externalIPs }} externalIPs: {{ toYaml .Values.service.externalIPs | indent 4 }} diff --git a/charts/prometheus-blackbox-exporter/values.yaml b/charts/prometheus-blackbox-exporter/values.yaml index 7a3ed66c2bba..889fc52bc919 100644 --- a/charts/prometheus-blackbox-exporter/values.yaml +++ b/charts/prometheus-blackbox-exporter/values.yaml @@ -416,3 +416,50 @@ verticalPodAutoscaler: # Specifies whether recommended updates are applied when a Pod is started and whether recommended updates # are applied during the life of a Pod. Possible values are "Off", "Initial", "Recreate", and "Auto". updateMode: Auto + +configReloader: + enabled: false + containerPort: 8080 + config: + logFormat: logfmt + logLevel: info + watchInterval: 1m + image: + registry: quay.io + repository: prometheus-operator/prometheus-config-reloader + tag: "v0.70.0" + pullPolicy: IfNotPresent + digest: "" + securityContext: + runAsUser: 1000 + runAsGroup: 1000 + readOnlyRootFilesystem: true + runAsNonRoot: true + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + resources: + limits: + memory: 50Mi + requests: + cpu: 10m + memory: 20Mi + livenessProbe: + httpGet: + path: /healthz + port: reloader-web + scheme: HTTP + readinessProbe: + httpGet: + path: /healthz + port: reloader-web + scheme: HTTP + service: + port: 8080 + serviceMonitor: + selfMonitor: + additionalMetricsRelabels: {} + additionalRelabeling: [] + path: /metrics + interval: 30s + scrapeTimeout: 30s