Skip to content

Commit 91e11fc

Browse files
authored
fix(helm): standardize global image registry to match other Grafana charts (#19246)
Signed-off-by: puretension <[email protected]>
1 parent ddc8393 commit 91e11fc

File tree

8 files changed

+30
-17
lines changed

8 files changed

+30
-17
lines changed

docs/sources/setup/install/helm/reference.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5402,7 +5402,16 @@ true
54025402
<tr>
54035403
<td>global.image.registry</td>
54045404
<td>string</td>
5405-
<td>Overrides the Docker registry globally for all images</td>
5405+
<td>Overrides the Docker registry globally for all images (deprecated, use global.imageRegistry)</td>
5406+
<td><pre lang="json">
5407+
null
5408+
</pre>
5409+
</td>
5410+
</tr>
5411+
<tr>
5412+
<td>global.imageRegistry</td>
5413+
<td>string</td>
5414+
<td>Overrides the Docker registry globally for all images (standard format)</td>
54065415
<td><pre lang="json">
54075416
null
54085417
</pre>

production/helm/loki/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Before upgrading to this version, make sure that the CustomResourceDefinitions (
5050

5151
- [BUGFIX] Explicitly set registry for k8s-sidecar image [#19233](<https://github.com/grafana/loki/pull/19233>]
5252
- [ENHANCEMENT] Add configurable `livenessProbe` and `startupProbe` for the nginx container in the gateway pods. [#18545](https://github.com/grafana/loki/pull/18545)
53+
- [ENHANCEMENT] Standardize global image registry configuration to match other Grafana charts [#19246](https://github.com/grafana/loki/pull/19246)
5354

5455
## 6.40.0
5556

production/helm/loki/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Create the name of the service account to use
160160
Base template for building docker image reference
161161
*/}}
162162
{{- define "loki.baseImage" }}
163-
{{- $registry := .global.registry | default .service.registry | default "" -}}
163+
{{- $registry := .global.imageRegistry | default ((.global.image).registry) | default .global.registry | default .service.registry | default "" -}}
164164
{{- $repository := .service.repository | default "" -}}
165165
{{- $ref := ternary (printf ":%s" (.service.tag | default .defaultVersion | toString)) (printf "@%s" .service.digest) (empty .service.digest) -}}
166166
{{- if and $registry $repository -}}

production/helm/loki/templates/backend/statefulset-backend.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,11 @@ spec:
143143
{{- toYaml .Values.backend.resources | nindent 12 }}
144144
{{- if .Values.sidecar.rules.enabled }}
145145
- name: loki-sc-rules
146+
{{- $dict := dict "service" .Values.sidecar.image "global" .Values.global }}
146147
{{- if .Values.sidecar.image.sha }}
147-
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
148+
image: "{{ include "loki.baseImage" $dict }}@sha256:{{ .Values.sidecar.image.sha }}"
148149
{{- else }}
149-
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}"
150+
image: {{ include "loki.baseImage" $dict }}
150151
{{- end }}
151152
imagePullPolicy: {{ .Values.sidecar.image.pullPolicy }}
152153
env:

production/helm/loki/templates/memcached/_memcached-statefulset.tpl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,9 @@ spec:
8989
{{ toYaml .extraContainers | nindent 8 }}
9090
{{- end }}
9191
- name: memcached
92-
{{- with $.ctx.Values.memcached.image }}
93-
image: {{ .repository }}:{{ .tag }}
94-
imagePullPolicy: {{ .pullPolicy }}
95-
{{- end }}
92+
{{- $dict := dict "service" $.ctx.Values.memcached.image "global" $.ctx.Values.global }}
93+
image: {{ include "loki.baseImage" $dict }}
94+
imagePullPolicy: {{ $.ctx.Values.memcached.image.pullPolicy }}
9695
resources:
9796
{{- if .resources }}
9897
{{- toYaml .resources | nindent 12 }}
@@ -155,10 +154,9 @@ spec:
155154

156155
{{- if $.ctx.Values.memcachedExporter.enabled }}
157156
- name: exporter
158-
{{- with $.ctx.Values.memcachedExporter.image }}
159-
image: {{ .repository}}:{{ .tag }}
160-
imagePullPolicy: {{ .pullPolicy }}
161-
{{- end }}
157+
{{- $dict := dict "service" $.ctx.Values.memcachedExporter.image "global" $.ctx.Values.global }}
158+
image: {{ include "loki.baseImage" $dict }}
159+
imagePullPolicy: {{ $.ctx.Values.memcachedExporter.image.pullPolicy }}
162160
ports:
163161
- containerPort: 9150
164162
name: http-metrics

production/helm/loki/templates/ruler/statefulset-ruler.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ spec:
125125
{{- toYaml .Values.ruler.resources | nindent 12 }}
126126
{{- if and .Values.sidecar.rules.enabled .Values.ruler.sidecar }}
127127
- name: loki-sc-rules
128+
{{- $dict := dict "service" .Values.sidecar.image "global" .Values.global }}
128129
{{- if .Values.sidecar.image.sha }}
129-
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
130+
image: "{{ include "loki.baseImage" $dict }}@sha256:{{ .Values.sidecar.image.sha }}"
130131
{{- else }}
131-
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}"
132+
image: {{ include "loki.baseImage" $dict }}
132133
{{- end }}
133134
imagePullPolicy: {{ .Values.sidecar.image.pullPolicy }}
134135
env:

production/helm/loki/templates/single-binary/statefulset.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,11 @@ spec:
153153
{{- toYaml .Values.singleBinary.resources | nindent 12 }}
154154
{{- if .Values.sidecar.rules.enabled }}
155155
- name: loki-sc-rules
156+
{{- $dict := dict "service" .Values.sidecar.image "global" .Values.global }}
156157
{{- if .Values.sidecar.image.sha }}
157-
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
158+
image: "{{ include "loki.baseImage" $dict }}@sha256:{{ .Values.sidecar.image.sha }}"
158159
{{- else }}
159-
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}"
160+
image: {{ include "loki.baseImage" $dict }}
160161
{{- end }}
161162
imagePullPolicy: {{ .Values.sidecar.image.pullPolicy }}
162163
env:

production/helm/loki/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
kubeVersionOverride: null
66

77
global:
8+
# -- Overrides the Docker registry globally for all images (standard format)
9+
imageRegistry: null
810
image:
9-
# -- Overrides the Docker registry globally for all images
11+
# -- Overrides the Docker registry globally for all images (deprecated, use global.imageRegistry)
1012
registry: null
1113
# -- Overrides the priorityClassName for all pods
1214
priorityClassName: null

0 commit comments

Comments
 (0)