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 {}.
Yeah, some of the errors that come out of the template engine are pretty obscure.
@tsloughter Closing due to inactivity. Please let me know if you want to re-open this issue. 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
hey @chainlink! Would you mind elaborating a little more on that? Nailing down that specific issue, what the error message is, how your chart is set up etc. would be a good action item to start returning better errors.
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 {}
I'm seeing basically the same thing as @NathanJiangCS Are we doing something obviously wrong here?
Hi @NathanJiangCS
I cannot reproduce your error so far. I re-created your chart and installing with a blank image tag I get the Image Tag Required message. If i install with a random tag and then try to helm upgrade with a blank tag, i get the Image Tag Required message again.
What version of Helm and Kubernetes are you using?
Helm:
Client: &version.Version{SemVer:"v2.7.2", GitCommit:"8478fb4fc723885b155c924d1c8c410b7a9444e6", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.7.2", GitCommit:"8478fb4fc723885b155c924d1c8c410b7a9444e6", GitTreeState:"clean"}
Kubernetes:
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.4", GitCommit:"9befc2b8928a9426501d3bf62f72849d5cbcd5a3", GitTreeState:"clean", BuildDate:"2017-11-20T05:28:34Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"8+", GitVersion:"v1.8.5-gke.0", GitCommit:"2c2a807131fa8708abc92f3513fe167126c8cce5", GitTreeState:"clean", BuildDate:"2017-12-19T20:05:45Z", GoVersion:"go1.8.3b4", Compiler:"gc", Platform:"linux/amd64"}
Weirdly enough, I cannot reproduce the errors I saw before. It probably was an error on my part.
@jeffutter Are you still having the problem?
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.
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'm running into the same issue
image:
init:
repository: busybox
tag: latest
pullPolicy: IfNotPresent
and in my deployment
image: "{{ .Values.image.init.repository }}:{{ .Values.image.init.tag }}"
And I get
Error: render error in "es/templates/es-master.yml": template: es/templates/es-master.yml:17:26: executing "es/templates/es-master.yml" at <.Values.image.es.rep...>: can't evaluate field repository in type interface {}
@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
@alexellis is your issue like this? i.e. in a range (loop)?
https://github.com/kubernetes/helm/issues/1311
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.
where did you set it? --set operation.create=true?
am getting this error: <.Values.ingress.enab...>: can't evaluate field enabled in type interface {}
I have the same issue with sub objects as described above. Has anyone figured out a fix for this?
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?
Did we open another ticket for this issue yet? I have a similar kind of issue, where i am trying to access subchart's value from an umbrella chart and apparently, tpl, can't parse it. Not sure what the root cause is, but if someone can look into it, would be great.
@bali0019 if you have suggestions on specific error messages, please feel free to open a new ticket for that.
@max-rocket-internet, in regards to opening a new issue to generally improve the error messages: it's very hard to quantify when it's considered acceptable to close out a ticket like that. Having tickets with very specific action items are best. e.g "helm templates with \
@bacongobbler I have an issue with umbrella chart, where i am trying to access values from subcharts, but i get this error, even though that field exists in subchart's values
: can't evaluate field sanity in type interface {}
@ctxrag was that with OpenFaaS or some other helm chart?
I too am experiencing this issue when using an umbrella chart with a common chart shared templates.
having the same issue here
make sure your yaml files are formatted correctly. use: helm lint .
is there a way to check? like .Values.something && .Values.something.somethingElse but in helm-crazy-lang?
Looks like {{- if ($.Values.service) and $.Values.service.enabled }} works to check a section exists first (in my case)
Edit: but how can I do the same check for sections? This still throws an error:
{{ if (.cloudflare) and (.cloudflare.secret) -}}
name: {{ .cloudflare.secret.name }}
key: {{ .cloudflare.secret.emailAddressKey }}
{{- else -}}
...
lol @ helm-crazy-lang. That's the best name I've heard yet for text/template :)
The proper syntax should be if and .cloudflare .cloudflare.secrets, FYI. and is a function in text/template that accepts two arguments; it's not a keyword that works like traditional programming languages.
@bacongobbler that's not working for me either unfortunately, this:
{{- if or (and (.cloudflare) (.cloudflare.enabled)) (and ($.Values.cloudflare) ($.Values.cloudflare.enabled)) }}
Gives:
[ERROR] templates/: render error in "XXX/templates/pre-delete-job.yaml": template: XXX/templates/pre-delete-job.yaml:3:41: executing "XXX/templates/pre-delete-job.yaml" at <.cloudflare.enabled>: can't evaluate field enabled in type interface {}
Was .cloudflare vs .Values.cloudflare intentional? That error seems to indicate .cloudflare doesn't exist.
Yes, that's right. I'm trying to check if it exists in scope, and if enabled exists too, or fall back to the root scope then look at $.Values there. This is all within a range, so .cloudflare should be correct. (Also, yes - it doesn't exist. I'm trying to detect that)
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
facing the same issue,anyone help? it worked for anyone?
I had the same issue. In my case the fix was to rename values.yml -> values.yaml
I am also facing the same issue. Why is it closed? I don't see any explanation or solution here.
Hi,
It looks like helm expects files as dot.yaml and not dot.yml. I faced the same issue as above and another issue with Chart.yml - so, I renamed them to values.yaml and Chart.yaml.
So, rename them to yaml and it should work.
Thanks
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
In my case I was using range and in Values.yaml file values were not defined correctly:
Incorrect way:
env:
node:
varA: value
varB: value
Right way:
env:
node:
- varA: value
varB: value
Notice a small hyphen (-) before varA .
-Rahul
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?
For all facing this issue double check your values.yaml filename. Mine was values.YML instead of values.yaml
Renaming it fixed the issue.
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.
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.
^^ exactly same issue RE values.yml instead of values.yaml. Kudos to helm lint suggestion!
I can't deploy a base helm 3 chart with autogenerated files.
at <.host>: can't evaluate field host in type interface {}
ingress.yaml
[snip]
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
values.yaml
ingress:
enabled: true
annotations: {}
hosts:
- host: chart-example.local
paths: []
tls: []
@masterkain You would need to configure host(s) in the value files. Have a look at the ingress doc in k8s for more details: https://kubernetes.io/docs/concepts/services-networking/ingress/
@hickeyma not sure what you mean.
helm3 create test
view ingress.yaml#31
view values.yaml#43
that config does not work for me out of the box, even if I put my real hosts, I get the templating error.
at <.host>: can't evaluate field host in type interface {}
@masterkain Can you create an issue and put the details in it inc. the values?
reducing the scope of the search, worked for me
Create the name for the database password secret key.
*/}}
{{- define "keycloak.dbPasswordKey" -}}
-{{- if and .Values.keycloak.persistence .Values.keycloak.persistence.existingSecret -}}
- {{- .Values.keycloak.persistence.existingSecretKey -}}
+{{- with .Values.keycloak.persistence -}}
+{{- if .existingSecret -}}
+ {{- .existingSecretKey -}}
{{- else -}}
password
{{- end -}}
+{{- end -}} # with
{{- end -}}
{{/*
with the helm lint . to the rescue, I would have gone mad otherwise
p.s. don't use the # with as way of commenting... it goes haywire... use {{- end -}}{{/* with */}}
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.
@jascott1 the confusing error message appears to still be a problem. Can this be reopened please?
@caleb15 were you looking to fix this? This issue was opened back in 2016.
If you want to address this issue, please open a PR.
It would be cool if I could fix it but I don't have any experience with go.
It would be better for someone else to fix this, and if the issue was open
there would be a higher chance of someone taking it on.
On Tue, Aug 11, 2020, 5:47 PM Matthew Fisher notifications@github.com
wrote:
Were you looking to fix this? This issue was opened back in 2016.
If you want to address this issue, please open a PR.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/helm/helm/issues/1579#issuecomment-672406719, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/ALCZY6IGXV64N6PZGE6QMPLSAHRBFANCNFSM4CXHON4A
.
Most helpful comment
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?