Helm lint error but everything looks ok to me

1/19/2019

I'm getting this error when linting my helm project

$ helm lint --debug                                
==> Linting .
[INFO] Chart.yaml: icon is recommended
[ERROR] templates/: render error in "myProject/templates/configmap.yaml": template: myProject/templates/configmap.yaml:26:27: executing "myProject/templates/configmap.yaml" at <.Values.fileServiceH...>: can't evaluate field fileHost in type interface {}

Error: 1 chart(s) linted, 1 chart(s) failed

This is my configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: myProject-configmap

data:
  tkn.yaml: |
    iss: "{{ .Values.iss }}"
    aud: "{{ .Values.aud }}"
  db.yaml: |
    database: "{{ .Values.database }}"
    user: "{{ .Values.user }}"
    host: "{{ .Values.host }}"
    dialect: "{{ .Values.dialect }}"
    pool:
      min: "{{ .Values.pool.min }}"
      max: "{{ .Values.pool.max }}"
      acquire: "{{ .Values.pool.acquire }}"
      idle: "{{ .Values.pool.idle }}"
  fileservice.yaml: |
    fileServiceHost:
      fileHost: "{{ .Values.fileServiceHost.fileHost }}"
  notificationservice.yaml: |
    notificationServiceHost:
      notificationHost: "{{ .Values.notificationservice.notificationHost }}"
  organizationservice.yaml: |
    organizationServiceHost:
      organizationHost: "{{ .Values.organizationservice.organizationHost }}"
  organizations.yaml: |
    organizations: {{ .Values.organizations | toJson | indent 4 }}
  epic.yaml: |
    redirectUri: "{{ .Values.redirectUri }}"

This is my /vars/dev/fileservice.yaml file

fileServiceHost:
  fileHost: 'https://example.com'

What is wrong that i'm getting this lint error?

-- Catfish
kubernetes
kubernetes-helm

1 Answer

1/19/2019

You want to either use .Files.Get to load the yaml files or take the yaml content that you have in the yaml files and capture it in the values.yaml so that you can insert it directly in your configmap with toYaml.

If the values are just static and you don't need the user to override them then .Files.Get is better for you. If you want to be able to override the content in the yaml files easily at install time then just represent them in the values.yaml file.

-- Ryan Dawson
Source: StackOverflow