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
- Remove top level object because of https://github.com/helm/helm/issues/1579 — committed to niiku/demo-argocd-repo by niiku 5 years ago
@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 ifblah
is defined in values.yamlmake 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 ofvalues.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 thatimage
had value) it generated config, but replaced values were empty. Then I realized that It’s having trouble loadingvalues.yaml
.I have this issue as well. My value file is named
values.yaml
and my deployment isdeployment.yaml
deployment.yaml
:values.yaml
:I get the infamous
I’m then doing the following changes:
deployment.yaml
values.yaml
: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:
Whereby
myDeployment
would “inherit” the defaulttitle
ofHello
, butotherDeployment
would “overwrite” with a specific title ofGoodbye
. Maybe there’s another way to do this?Edit: do I need to set up a new
dict
, thenrange
through both levels andset
keys, then use thatdict
? Any help would be greatI 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)
The code:
Chart.yaml
Interestingly (Frustratingly?) It works if I reference .Chart.name instead of .Chart.appVersion
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:
values.yaml
:This error is produced when I try to upgrade with these values: