Skip to content

Conversation

@puretension
Copy link
Contributor

@puretension puretension commented Sep 21, 2025

What this PR does / why we need it:

This PR standardizes the global image registry configuration to match other Grafana charts by supporting the standard global.imageRegistry format while maintaining backwards compatibility with the existing global.image.registry format.

Currently, Loki chart uses a different structure for global image registry override compared to other Grafana charts:

  • Loki (current): global.image.registry
  • Other Grafana charts (standard): global.imageRegistry

This inconsistency forces users to configure different charts differently, contradicting the purpose of having a global override.

Which issue(s) this PR fixes:
Fixes #16511
Fixes #19212

Special notes for your reviewer:

This change maintains full backwards compatibility - existing configurations using global.image.registry will continue to work. The precedence order is: global.imageRegistry > global.image.registry > global.registry > service.registry.

The existing global.image.registry is marked as deprecated in documentation to encourage migration to the standard format.

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added (updated values.yaml comments)
  • Tests updated (not applicable - template logic change)
  • Title matches the required conventional commits format, see here
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md (not required - backwards compatible)
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively (not applicable - no removal, only deprecation notice in comments)

Changes Made

  1. Updated _helpers.tpl: Modified loki.baseImage template to support standard global.imageRegistry
  2. Updated values.yaml: Added global.imageRegistry with proper documentation and marked existing format as deprecated
  3. Maintained compatibility: All existing configurations continue to work

Before/After

Before:

global:
 image:
   registry: my-registry.com  # Only way to set global registry

After (both work, standard recommended):

# New standard format (recommended)
global:
 imageRegistry: my-registry.com

@puretension puretension requested a review from a team as a code owner September 21, 2025 18:52
type: application
appVersion: 3.5.3
version: 6.40.0
version: 6.40.1
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to update the version number, this is handled automatically as part of the automation. See here for an example.

Copy link
Contributor Author

@puretension puretension Sep 23, 2025

Choose a reason for hiding this comment

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

@JStickler Thank you for pointing that out! I understand now that chart version updates are handled automatically by the release automation. I've reverted the version change from 6.40.1 back to 6.40.0.

Thanks to your guidance, I now have a better understanding of the project's workflow and won't repeat these mistakes. Thank you for your patience! 🫡

@JStickler JStickler changed the title fix: standardize global image registry to match other Grafana charts fix(helm): standardize global image registry to match other Grafana charts Sep 23, 2025
Fixes grafana#19212

This PR standardizes the global image registry configuration to match
other Grafana charts by supporting the standard global.imageRegistry format
while maintaining backwards compatibility.

Changes:
- Add support for standard global.imageRegistry in _helpers.tpl
- Add global.imageRegistry to values.yaml with proper documentation
- Maintain backwards compatibility with existing global.image.registry
- Update precedence order: global.imageRegistry > global.image.registry > global.registry

Users can now use the standard format across all Grafana charts:
global:
  imageRegistry: my-registry.com

While existing configurations continue to work:
global:
  image:
    registry: my-registry.com

Signed-off-by: puretension <[email protected]>
@puretension puretension force-pushed the fix/standardize-global-image-registry-19212 branch from 5a80da6 to 89595ea Compare September 23, 2025 13:59
Copy link
Contributor

@jkroepke jkroepke left a comment

Choose a reason for hiding this comment

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

*/}}
{{- 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
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
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! 🙏

- Extended global.imageRegistry support to memcached, memcachedExporter, and sidecar images
- All images now consistently use loki.baseImage helper for global registry override
- Ensures complete standardization across the entire chart

Addresses reviewer feedback on incomplete image coverage.

Signed-off-by: puretension <[email protected]>
@jkroepke
Copy link
Contributor

@puretension could you add an Fixes #16511 as well on the first post?

@jkroepke
Copy link
Contributor

@puretension Still missing a CHANGELOG entry. Please add one.

…tion

Add CHANGELOG entry for PR grafana#19246 that standardizes global image registry
configuration to match other Grafana charts.

Signed-off-by: puretension <[email protected]>
@puretension
Copy link
Contributor Author

@jkroepke Both requests have been addressed!
I've added Fixes #16511 to the PR description so both issues will be automatically closed when merged,
and I've also added the CHANGELOG entry under the Unreleased section following the project's format.
Please let me know if there's anything else I missed. Thanks for the guidance! 🙏

@jkroepke
Copy link
Contributor

This should be merged before #19347 gets merged.

LGTM

Copy link
Contributor

@Jayclifford345 Jayclifford345 left a comment

Choose a reason for hiding this comment

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

LGTM

@Jayclifford345 Jayclifford345 merged commit 91e11fc into grafana:main Oct 28, 2025
79 checks passed
Scrumplex added a commit to Scrumplex/loki that referenced this pull request Oct 31, 2025
Since grafana#19246 the sidecar image would
resolve to registry-mirror.example.com/docker.io/kiwigrid/k8s-sidecar
when a global registry mirror was defined.

Signed-off-by: Sefa Eyeoglu <[email protected]>
Scrumplex added a commit to Scrumplex/loki that referenced this pull request Oct 31, 2025
Since grafana#19246 the sidecar image would
resolve to registry-mirror.example.com/docker.io/kiwigrid/k8s-sidecar
when a global registry mirror was defined.

Signed-off-by: Sefa Eyeoglu <[email protected]>
Scrumplex added a commit to Scrumplex/loki that referenced this pull request Oct 31, 2025
Since grafana#19246 the sidecar image would
resolve to registry-mirror.example.com/docker.io/kiwigrid/k8s-sidecar
when a global registry mirror was defined.

Signed-off-by: Sefa Eyeoglu <[email protected]>
Scrumplex added a commit to Scrumplex/loki that referenced this pull request Oct 31, 2025
Since grafana#19246 the sidecar image would
resolve to registry-mirror.example.com/docker.io/kiwigrid/k8s-sidecar
when a global registry mirror was defined.

Signed-off-by: Sefa Eyeoglu <[email protected]>
Scrumplex added a commit to Scrumplex/loki that referenced this pull request Nov 3, 2025
Since grafana#19246 the sidecar image would
resolve to registry-mirror.example.com/docker.io/kiwigrid/k8s-sidecar
when a global registry mirror was defined.

Signed-off-by: Sefa Eyeoglu <[email protected]>
Scrumplex added a commit to Scrumplex/loki that referenced this pull request Nov 4, 2025
Since grafana#19246 the sidecar image would
resolve to registry-mirror.example.com/docker.io/kiwigrid/k8s-sidecar
when a global registry mirror was defined.

Signed-off-by: Sefa Eyeoglu <[email protected]>
Scrumplex added a commit to Scrumplex/loki that referenced this pull request Nov 4, 2025
Since grafana#19246 the sidecar image would
resolve to registry-mirror.example.com/docker.io/kiwigrid/k8s-sidecar
when a global registry mirror was defined.

Signed-off-by: Sefa Eyeoglu <[email protected]>
@LukoJy3D
Copy link
Contributor

LukoJy3D commented Nov 7, 2025

This introduced some problems mentioned in #19662

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Global Image Registry value format for Loki

5 participants