twuni/docker-registry.helm

Chart 2.2.1 Update Failed

Vertiwell opened this issue · 7 comments

Hi,
I tried to update to the latest version of the chart today, however I get the error:
Error: UPGRADE FAILED: YAML parse error on docker-registry/templates/deployment.yaml: error converting YAML to JSON: yaml: line 80: mapping values are not allowed in this context
Is this likely an issue with my custom values.yaml?
No issues with 2.2.0.
Thank you.

@Vertiwell Can you show us the custom values.yaml? Otherwise, it's more guessing than anything else. Maybe you should also compare it to line 80 in templates/deployment.yaml.

Hi

Same here. Seems to be linked to the extravolumes and extravolumemounts
See this :

git clone https://github.com/twuni/docker-registry.helm.git
cd docker-registry.helm.git
cat custom-values.yml
extraVolumeMounts:
  - mountPath: /certs
    name: gitlab-auth-cert
    readOnly: true

extraVolumes:
  - name: gitlab-auth-cert
    secret:
      secretName: gitlab-auth-cert
helm template -f custom-values.yml .
Error: YAML parse error on docker-registry/templates/deployment.yaml: error converting YAML to JSON: yaml: line 62: mapping values are not allowed in this context

Use --debug flag to render out invalid YAML
replicaCount: 3
persistence:
  accessMode: 'ReadWriteOnce'
  enabled: true
  size: 5Gi
  storageClass: '${LOCAL}'
tlsSecretName: tls-cert
secrets:
  haSharedSecret: ""
  htpasswd: "${HELMPASSWORD}"
extraVolumeMounts:
  - name: ca-store
    mountPath: /etc/ssl/certs/custom-ca.crt
    subPath: custom-ca.crt
    readOnly: true
extraVolumes:
  - name: ca-store
    configMap:
      name: trust-operator

Can confirm the issue in 2.2.1 (version 2.2.0. is ok).

Probably it is somewhere in v2.2.0...v2.2.1#diff-87d68c754766af8e2e930e653be7e4b75fa0c8bdb187cb1bec293f265d9159ffR170-R172
I assume the indentation went missing.

In 2.2.0 it looked like this:

{{- with .Values.extraVolumes }}
            {{- toYaml . | nindent 12 }}
{{- end }}

Now it's slightly different:

{{- with .Values.extraVolumes }}
{{- toYaml . }}
{{- end }}

I found the solution!

In the _helpers.tpl file for the sections extraVolumeMounts and extraVolumes there is a unnecessary hypehn (-) at the beginning of the template definition:

{{- with .Values.extraVolumeMounts }}
{{- toYaml . }}
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . }}
{{- end }}

But should be:

{{- with .Values.extraVolumeMounts }}
{{ toYaml . }}
{{- end }}
{{- with .Values.extraVolumes }}
{{ toYaml . }}
{{- end }}

This was already implemented at {{- with .Values.extraEnvVars }} but not for the volumes. I am going to create a pull request. :)

Thanks @Vertiwell for reporting, + @WTFKr0 and @pieveee for investigating, and @pieveee for fixing! #74 does appear to fix the issue, just needs signed commits. I'll ship a fix release as soon as that's signed off and ready.

Fixed in v2.2.2. Thanks to everyone who helped get that fix across the line, especially @pieveee!