Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prometheus-elasticsearch-exporter] Allow to override imageRegistry globally #4497

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.8.0
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