How to get the output file without yaml validation in Helm charts?

Viewed 77

I have Helm charts that try to install a service on k8s. when I am trying to run this command it shows this error:

YAML parse error on myService/templates/configmap.yaml: error converting YAML to JSON: yaml: line 152: did not find expected key

here is my configmap.yaml file:

{{- if .Values.configFiles }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "revad.fullname" . }}-config
  labels:
    {{- include "revad.labels" . | nindent 4 }}
data:
{{- $host := .Values.HostURL }}
{{- $ocHost := .Values.OCURL }}
{{- $secret := .Values.SharedSecret }}
{{- $certFile := .Values.CertFile }}
{{- $certKey := .Values.CertKey }}
{{- range $filename, $fileContents := .Values.configFiles }}
  {{ $filename }}: |-
{{ if eq $filename "oc.revad.toml" }}
  {{ $fileContents | indent 4 | replace "OC_URL" $ocHost | replace "HOST_URL" $host | replace "SHARED_SECRET" $secret | replace "CERT_FILE" $certFile | replace "CERT_KEY" $certKey | quote }}
{{ else }}  
  {{ $fileContents | indent 4 }}
{{ end }}  
{{- end }}
{{- end }}

I cannot find the exact location of the error. I was wondering how much it would be helpful if there were an option that shows the output file without any YAML validation to debug my template. does helm has this option? if the answer is no, so how can I debug my helm chart?

1 Answers

Helm Debugging Templates

helm template --debug test .

It's a great way to have the server render your templates, then return the resulting manifest file.

(And may you provide values.yaml to help locate errors?)

Related