Skip to content

Commit

Permalink
[prometheus-elasticsearch-exporter] Allow to override imageRegistry g…
Browse files Browse the repository at this point in the history
…lobally

Signed-off-by: Jeroen van Erp <[email protected]>
  • Loading branch information
hierynomus committed Apr 29, 2024
1 parent fd69f63 commit 0a2339c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-elasticsearch-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Elasticsearch stats exporter for Prometheus
name: prometheus-elasticsearch-exporter
version: 5.7.0
version: 5.7.1
kubeVersion: ">=1.10.0-0"
appVersion: "v1.7.0"
home: https://github.com/prometheus-community/elasticsearch_exporter
Expand Down
15 changes: 15 additions & 0 deletions charts/prometheus-elasticsearch-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,18 @@ imagePullSecrets:
{{- end }}
{{- end }}
{{- end -}}

{{/*
Return the correct (overridden global) image registry.
*/}}
{{- define "elasticsearch-exporter.image.repository" -}}
{{- $registry := .Values.image.registry -}}
{{- if .Values.global.imageRegistry }}
{{- $registry = .Values.global.imageRegistry -}}
{{- end }}
{{- if $registry -}}
{{- printf "%s/%s" $registry .Values.image.repository -}}
{{- else -}}
{{- printf "%s" .Values.image.repository -}}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ spec:
- secretRef:
name: {{ .Values.envFromSecret }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
image: "{{- include "elasticsearch-exporter.image.repository" .}}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["elasticsearch_exporter",
{{- with .Values.log.format }}
Expand Down
2 changes: 2 additions & 0 deletions charts/prometheus-elasticsearch-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## to set the same values for each chart (and image) separately
global:
imagePullSecrets: []
imageRegistry: ""

## number of exporter instances
##
Expand All @@ -13,6 +14,7 @@ replicaCount: 1
restartPolicy: Always

image:
registry: ""
repository: quay.io/prometheuscommunity/elasticsearch-exporter
# if not set appVersion field from Chart.yaml is used
tag: ""
Expand Down

0 comments on commit 0a2339c

Please sign in to comment.