helm: Confusing error message on missing template value

If a template includes an item like:

"{{ .Values.postgresql.postgresPassword }}"

And the value is not defined, when running lint you get:

[WARNING] templates/post-install-job.yaml: these substitution functions are returning no value: [{{ .Values.postgresql.postgresPassword }}]

However, if you have something undefined that is an extra level like:

"{{ .Values.postgresql.notdefined.postgresPassword }}"

You get an error message when linting or installing that includes Go specific messaging:

[ERROR] templates/: render error in ".../templates/post-install-job.yaml": template: .../templates/post-install-job.yaml:52:28: executing ".../templates/post-install-job.yaml" at <.Values.postgresql.n...>: can't evaluate field postgresPassword in type interface {}

Maybe it should still be an error instead of a warning like the other, but I think it definitely could be worded better to not use type interface {}.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 41
  • Comments: 54 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@tsloughter Closing due to inactivity. Please let me know if you want to re-open this issue. Thanks!

Many of the errors from helm templates are very obscure or hard to understand. Maybe we should have a another github issue to generally improve the error messages?

Ok glad you got things figured out. Im going to close this one but please open a new issue if you have more problems. Thanks!

I’ve had the same issue. It appears sub objects don’t work ie. .Values.blah is fine, but .Values.blah.foo does not work, even if blah is defined in values.yaml

make sure your yaml files are formatted correctly. use: helm lint .

No, I think I was missing a part of the reference putting --set create=true instead of --set operator.create=true - that was not clear from the error. Hope this helps someone else.

@jonathan-kosgei what was the fix? cc @jascott1

I have the same issue and all I can find is people saying “oh it’s fixed now” kind of thing. Thanks

In my case I named file values.yml instead of values.yaml.

If it can’t locate file, it crashes on 2nd lvl nesting. So doing {{ .Values.awesome.image }} will crash.

If I tried only {{ .Values.image }} (and also made sure that image had value) it generated config, but replaced values were empty. Then I realized that It’s having trouble loading values.yaml.

I have this issue as well. My value file is named values.yaml and my deployment is deployment.yaml

deployment.yaml:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: {{ template "unicorn.name" . }}
  labels:
    app: {{ template "unicorn.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ template "unicorn.releasedVersionName" . }}
    heritage: {{ .Release.Service }}
    version: {{ .Chart.Version }}
spec:
  replicas: {{ .Values.replicaCount }}
  template:
    metadata:
      labels:
        app: {{ template "unicorn.name" . }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}

values.yaml:

versionName: whatever
replicaCount: 5
image:
  repository: myself/myimage
  tag: whatever
  pullPolicy: Always

I get the infamous

render error in "unicorn/templates/deployment.yaml": template: unicorn/templates/deployment.yaml:20:28: executing "unicorn/templates/deployment.yaml" at <.Values.image.reposi...>: can't evaluate field repository in type interface {}, requeuing

I’m then doing the following changes:

deployment.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: {{ .Chart.Name }}
spec:
  replicas: {{ .Values.replicaCount }}
  template:
    metadata:
      labels:
        app: {{ .Chart.Name }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.repository }}:{{ .Values.tag }}"
          imagePullPolicy: {{ .Values.pullPolicy }}

values.yaml:

versionName: whatever
replicaCount: 5
repository: myself/myimage
tag: whatever
pullPolicy: Always

I don’t run into those issues.

facing the same issue,anyone help? it worked for anyone?

I have the same issue with sub objects as described above. Has anyone figured out a fix for this?

https://stackoverflow.com/questions/44675087/golang-template-variable-isset makes me think… “ouch”.

I’m trying to do a hierarchy of settings, for instance:

title: Hello

deployments:
  myDepoyment:
    role: one
  otherDeployment:
    title: Goodbye

Whereby myDeployment would “inherit” the default title of Hello, but otherDeployment would “overwrite” with a specific title of Goodbye. Maybe there’s another way to do this?

Edit: do I need to set up a new dict, then range through both levels and set keys, then use that dict? Any help would be great

I too am experiencing this issue when using an umbrella chart with a common chart shared templates.

I think the issue I was seeing was that I was trying to reference values from sub-charts in each other.

For Example

MainChart |— SubChartA |— SubChartB

I was trying to do something like {{ Values.SubChartA.something }} in Sub Chart B, which I now gather isn’t how things are intended to work.

I have been constantly receiving this error message when trying to check in my deployment.yaml file for defined values in a subchart (redis in my case) using helm 3 as so: name: {{ ternary .Values.redis.existingSecret (printf "%s-%s" .Release.Name "redis") .Values.redis.existingSecret | quote }}

The only way I personally found to circumvent this was to define the variables at the top of the file as such: {{- $redisExistingSecret := .Values.redis.existingSecret | default nil}}

Then instead of the line before I did name: {{ ternary $redisExistingSecret (printf "%s-%s" .Release.Name "redis") $redisExistingSecret | quote }} and this seems to have worked for me.

Hope it helps someone.

I am also facing the same issue in version 2.12.3 My values YAML structure is like: values.yaml global: configMap properties: my: services: war: truststore: password: abcxyz

Error: can’t evaluate field password in type interface {}

helm version Client: &version.Version{SemVer:“v2.12.3”, GitCommit:“eecf22f77df5f65c823aacd2dbd30ae6c65f186e”, GitTreeState:“clean”} Server: &version.Version{SemVer:“v2.12.3”, GitCommit:“eecf22f77df5f65c823aacd2dbd30ae6c65f186e”, GitTreeState:“clean”}

kubectl version

Client Version: version.Info{Major:“1”, Minor:“12”, GitVersion:“v1.12.5”, GitCommit:“51dd616cdd25d6ee22c83a858773b607328a18ec”, GitTreeState:“clean”, BuildDate:“2019-01-16T18:24:45Z”, GoVersion:“go1.10.7”, Compiler:“gc”, Platform:“linux/amd64”} Server Version: version.Info{Major:“1”, Minor:“12”, GitVersion:“v1.12.5”, GitCommit:“51dd616cdd25d6ee22c83a858773b607328a18ec”, GitTreeState:“clean”, BuildDate:“2019-01-16T18:14:49Z”, GoVersion:“go1.10.7”, Compiler:“gc”, Platform:“linux/amd64”}

Does anybody have any fix for this?

My Chart.yaml is called Chart.yaml, and I still get that error: I just have the main chart (no subcharts)

Error: render error in "helm/templates/service-db.yaml": template: helm/templates/service-db.yaml:7:40: executing "helm/templates/service-db.yaml" at <.Chart.appVersion>: can't evaluate field appVersion in type interface {}

shell returned 1

The code:

    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/version: {{ .Chart.appVersion }}
    app.kubernetes.io/component: frontend

Chart.yaml

apiVersion: v1
appVersion: "5.6.0.3856-ion70"
description: test application
name: testapp
version: 0.1.1

Interestingly (Frustratingly?) It works if I reference .Chart.name instead of .Chart.appVersion

==> Linting .
[INFO] Chart.yaml: icon is recommended

1 chart(s) linted, no failures

I’m on version v2.10.0

I am also facing the same issue. Why is it closed? I don’t see any explanation or solution here.

having the same issue here

am getting this error: <.Values.ingress.enab…>: can’t evaluate field enabled in type interface {}

Having the same issue.

Chart:

{{- if .Values.sidekiq.enabled }}
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: {{ .Release.Name }}-sidekiq
spec:
  replicas: {{ .Values.sidekiq.replicaCount }}
  template:
    metadata:
      labels:
        app: {{ .Release.Name }}-sidekiq
      annotations:
        prometheus.io/port: "3000"
        prometheus.io/scrape: "true"
    spec:
      containers:
      - name: {{ .Release.Name }}-sidekiq
        image: "{{ required "Repository required" .Values.image.repository }}:{{ required "Image tag required" .Values.image.tag }}"
        command: ["bundle"]
        args: ["exec", "sidekiq", "-C", "config/sidekiq.yml"]
        resources:
{{ toYaml .Values.sidekiq.resources | indent 10 }}
        ports:
        - containerPort: 3000
{{ end }}

values.yaml:

image:
  repository: "gcr.io/something/something"
  tag: ""

sidekiq:
  enabled: true
  replicaCount: 1
  resources:
    requests:
      memory: "250Mi"
      cpu: "250m"
    limits:
      memory: "2Gi"
      cpu: "1"

This error is produced when I try to upgrade with these values:

Error: UPGRADE FAILED: render error in "web/templates/sidekiq-deployment.yaml": template: web/templates/sidekiq-deployment.yaml:1:14: executing "web/templates/sidekiq-deployment.yaml" at <.Values.sidekiq.enab...>: can't evaluate field enabled in type interface {}