[Helm Chart] - Wrong handling of image registry and repository
Author: tmeltserCreated Dec 18, 2024Updated Sep 12, 2026
Labelskind/buglifecycle/stale
Describe the bug:
The helm chart has multiple occurrences of registry keys, all are commented out. In case one of them is unmarked, the "image" named template will generate a wrong image ref: From values.yaml:
image:
# The container registry to pull the manager image from.
# +docs:property
# registry: quay.io
# The container image for the cert-manager controller.
# +docs:property
repository: quay.io/jetstack/cert-manager-controllerFrom _helpers.tpl:
{{- define "image" -}}
{{- $defaultTag := index . 1 -}}
{{- with index . 0 -}}
{{- if .registry -}}{{ printf "%s/%s" .registry .repository }}{{- else -}}{{- .repository -}}{{- end -}}
{{- if .digest -}}{{ printf "@%s" .digest }}{{- else -}}{{ printf ":%s" (default $defaultTag .tag) }}{{- end -}}
{{- end }}
{{- end }} The code in the line {{- if .registry -}}{{ printf "%s/%s" .registry .repository }}{{- else -}}{{- .repository -}}{{- end -}} will generate a wrong image ref as the repository also contains the registry...
Or am I missing something?
Expected behaviour:
Stating a registry should not break the image ref
Steps to reproduce the bug:
Set a custom registry and watch the generated image ref
Anything else we need to know?: Solution suggestion:
- Uncomment all the registry keys, giving them a default value of 'quay.io'
- Remove the 'quay.io' prefix from all the repository keys
- Fix the 'image' named function by replacing the problematic line stated above with:
{{ printf "%s/%s" .registry .repository }}
Environment details::
- Kubernetes version: N/A
- Cloud-provider/provisioner: N/A
- cert-manager version: latest
- Install method: e.g. helm/static manifests (N/A)
/kind bug
Source: cert-manager/cert-manager