Skip to content

[Helm Chart] - Wrong handling of image registry and repository #7476

Description

@tmeltser

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-controller

From _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:

  1. Uncomment all the registry keys, giving them a default value of 'quay.io'
  2. Remove the 'quay.io' prefix from all the repository keys
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions