can't evaluate field Release in type []interface {}
This is what I did.
1. Followed the instruction to create a new chart
helm create mychart
2. add common
cd mychart/charts
helm fetch common/common
Note that the last command (helm fetch) is different from what is described in the instruction. If I used
helm fetch common
I then got
Error: Non-absolute URLs should be in form of repo_name/path_to_chart, got: common
3. add a some.yaml file under mychart/templates/
{{- template "common.deployment" (list . "mychart.deployment") -}}
{{- define "mychart.deployment" -}}
## Define overrides for your Deployment resource here, e.g.
spec:
template:
spec:
containers:
- {{ template "common.container" (list . "mychart.deployment.container") }}
{{- end -}}
{{- define "mychart.deployment.container" -}}
## Define overrides for your Container here, e.g.
livenessProbe:
httpGet:
path: /
port: 80
readinessProbe:
httpGet:
path: /
port: 80
{{- end -}}
4. ran this command
helm template --name myrelease mychart
and then got
Error: render error in "mychart/templates/some.yaml": template: mychart/charts/common/templates/_common.tpl:17:27: executing "common.fullname" at <.Release.Name>: can't evaluate field Release in type []interface {}
Question:
Where did I do wrong?
@cch0 does helm install --name myrelease --dry-run --debug mychart work for you? Also what version of Helm do you have?
helm install --name myrelease --dry-run --debug mychart
[debug] Created tunnel using local port: '62377'
[debug] SERVER: "127.0.0.1:62377"
[debug] Original chart version: ""
[debug] CHART PATH: /Users/xxx/playground/tmp/mychart
Error: render error in "mychart/templates/some.yaml": template: mychart/charts/common/templates/_common.tpl:17:27: executing "common.fullname" at <.Release.Name>: can't evaluate field Release in type []interface {}
Helm version
Client: &version.Version{SemVer:"v2.10.0", GitCommit:"9ad53aac42165a5fadc6c87be0dea6b115f93090", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.10.0", GitCommit:"9ad53aac42165a5fadc6c87be0dea6b115f93090", GitTreeState:"clean"}
hmm, I'm not sure why .Release would be empty. @bacongobbler have you seen this before?
Can't say that I have, no :S
I'm also using that version of Helm, 2.10.0 and when I use {{ .Release.Name }} in a particular spot, I get a similar error: executing "demo/templates/ingress.yaml" at <.Release.Name>: can't evaluate field Name in type interface {}
Had to work around it by defining $releaseName at the top of the file and using that instead: {{- $releaseName := .Release.Name -}}
@cfedersp $ let's you reference values in the parent scope: {{ $.Release.Name }}