Skip to content
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
11 changes: 10 additions & 1 deletion docs/sources/setup/install/helm/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -5402,7 +5402,16 @@ true
<tr>
<td>global.image.registry</td>
<td>string</td>
<td>Overrides the Docker registry globally for all images</td>
<td>Overrides the Docker registry globally for all images (deprecated, use global.imageRegistry)</td>
<td><pre lang="json">
null
</pre>
</td>
</tr>
<tr>
<td>global.imageRegistry</td>
<td>string</td>
<td>Overrides the Docker registry globally for all images (standard format)</td>
<td><pre lang="json">
null
</pre>
Expand Down
1 change: 1 addition & 0 deletions production/helm/loki/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Before upgrading to this version, make sure that the CustomResourceDefinitions (

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

## 6.40.0

Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Create the name of the service account to use
Base template for building docker image reference
*/}}
{{- define "loki.baseImage" }}
{{- $registry := .global.registry | default .service.registry | default "" -}}
{{- $registry := .global.imageRegistry | default ((.global.image).registry) | default .global.registry | default .service.registry | default "" -}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about non loki image, e.g nginx and memcache?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkroepke Thank you for catching this critical issue! You're absolutely right and this was the hidden root cause I missed.

While I updated the loki.baseImage helper to support global.imageRegistry, I only applied it to the main Loki image. The nginx, memcached, memcachedExporter, and sidecar images were still using direct
{{ .repository }}:{{ .tag }} format, completely bypassing the global registry logic.

I've now extended the fix to ensure all images consistently use the loki.baseImage helper:

  • Memcached & MemcachedExporter images
  • Sidecar images (single-binary, backend, ruler deployments)
  • Gateway (nginx) was already using loki.gatewayImageloki.baseImage

This ensures true global registry standardization across the entire chart, matching the Grafana helm pattern you referenced.

Example usage:

yaml
global:
 imageRegistry: my-registry.com

Great catch on the incomplete implementation! 🙏

{{- $repository := .service.repository | default "" -}}
{{- $ref := ternary (printf ":%s" (.service.tag | default .defaultVersion | toString)) (printf "@%s" .service.digest) (empty .service.digest) -}}
{{- if and $registry $repository -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,11 @@ spec:
{{- toYaml .Values.backend.resources | nindent 12 }}
{{- if .Values.sidecar.rules.enabled }}
- name: loki-sc-rules
{{- $dict := dict "service" .Values.sidecar.image "global" .Values.global }}
{{- if .Values.sidecar.image.sha }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
image: "{{ include "loki.baseImage" $dict }}@sha256:{{ .Values.sidecar.image.sha }}"
{{- else }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}"
image: {{ include "loki.baseImage" $dict }}
{{- end }}
imagePullPolicy: {{ .Values.sidecar.image.pullPolicy }}
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ spec:
{{ toYaml .extraContainers | nindent 8 }}
{{- end }}
- name: memcached
{{- with $.ctx.Values.memcached.image }}
image: {{ .repository }}:{{ .tag }}
imagePullPolicy: {{ .pullPolicy }}
{{- end }}
{{- $dict := dict "service" $.ctx.Values.memcached.image "global" $.ctx.Values.global }}
image: {{ include "loki.baseImage" $dict }}
imagePullPolicy: {{ $.ctx.Values.memcached.image.pullPolicy }}
resources:
{{- if .resources }}
{{- toYaml .resources | nindent 12 }}
Expand Down Expand Up @@ -155,10 +154,9 @@ spec:

{{- if $.ctx.Values.memcachedExporter.enabled }}
- name: exporter
{{- with $.ctx.Values.memcachedExporter.image }}
image: {{ .repository}}:{{ .tag }}
imagePullPolicy: {{ .pullPolicy }}
{{- end }}
{{- $dict := dict "service" $.ctx.Values.memcachedExporter.image "global" $.ctx.Values.global }}
image: {{ include "loki.baseImage" $dict }}
imagePullPolicy: {{ $.ctx.Values.memcachedExporter.image.pullPolicy }}
ports:
- containerPort: 9150
name: http-metrics
Expand Down
5 changes: 3 additions & 2 deletions production/helm/loki/templates/ruler/statefulset-ruler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,11 @@ spec:
{{- toYaml .Values.ruler.resources | nindent 12 }}
{{- if and .Values.sidecar.rules.enabled .Values.ruler.sidecar }}
- name: loki-sc-rules
{{- $dict := dict "service" .Values.sidecar.image "global" .Values.global }}
{{- if .Values.sidecar.image.sha }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
image: "{{ include "loki.baseImage" $dict }}@sha256:{{ .Values.sidecar.image.sha }}"
{{- else }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}"
image: {{ include "loki.baseImage" $dict }}
{{- end }}
imagePullPolicy: {{ .Values.sidecar.image.pullPolicy }}
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,11 @@ spec:
{{- toYaml .Values.singleBinary.resources | nindent 12 }}
{{- if .Values.sidecar.rules.enabled }}
- name: loki-sc-rules
{{- $dict := dict "service" .Values.sidecar.image "global" .Values.global }}
{{- if .Values.sidecar.image.sha }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
image: "{{ include "loki.baseImage" $dict }}@sha256:{{ .Values.sidecar.image.sha }}"
{{- else }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}"
image: {{ include "loki.baseImage" $dict }}
{{- end }}
imagePullPolicy: {{ .Values.sidecar.image.pullPolicy }}
env:
Expand Down
4 changes: 3 additions & 1 deletion production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
kubeVersionOverride: null

global:
# -- Overrides the Docker registry globally for all images (standard format)
imageRegistry: null
image:
# -- Overrides the Docker registry globally for all images
# -- Overrides the Docker registry globally for all images (deprecated, use global.imageRegistry)
registry: null
# -- Overrides the priorityClassName for all pods
priorityClassName: null
Expand Down
Loading