Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

can't evaluate field Release in type []interface {} #5

Open
cch0 opened this issue Sep 24, 2018 · 6 comments
Open

can't evaluate field Release in type []interface {} #5

cch0 opened this issue Sep 24, 2018 · 6 comments

Comments

@cch0
Copy link

cch0 commented Sep 24, 2018

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?

@prydonius
Copy link
Collaborator

@cch0 does helm install --name myrelease --dry-run --debug mychart work for you? Also what version of Helm do you have?

@cch0
Copy link
Author

cch0 commented Sep 24, 2018

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"}

@prydonius
Copy link
Collaborator

hmm, I'm not sure why .Release would be empty. @bacongobbler have you seen this before?

@bacongobbler
Copy link

Can't say that I have, no :S

@cfedersp
Copy link

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 -}}

@LucidNeko
Copy link

@cfedersp $ let's you reference values in the parent scope: {{ $.Release.Name }}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants