Re: Helm

Matt Fisher <matt.fisher@...>

In your example, you are passing a variable of type string ("need value") to your function "mypath". Inside your "mypath" function,. it's looking for an object with a field called Values.

If you change your `include` function call to {{ include "mypath" $ }}, what happens?


Matthew Fisher

Caffeinated Software Engineer

Microsoft Canada

From: cncf-helm@... <cncf-helm@...> on behalf of lmadan via Lists.Cncf.Io <>
Sent: Thursday, March 19, 2020 2:57 PM
To: cncf-helm@... <cncf-helm@...>
Cc: cncf-helm@... <cncf-helm@...>
Subject: [cncf-helm] Helm
Hi all, i have a quick question. I have the chart hierarchyparentChart
— template
— _helpers.tpl— charts
— chart1
— _helpers.tpl
— chart2In parent chart i have defined
{{- define “mypath" -}}
{{- if .Values.common -}}
{{- required "common.mypath is required !" .Values.common.mypath -}}
{{- else -}}
{{- required " is required !"}}
{{- end -}}
{{- end -}}And now in chart1 i am trying to refer{{- define "mypath" }}
from: parentChart
{{- end -}}{{- define “copyMyPath” -}}
{{- include "mypath" "need value"}}
{{- end -}}I am getting below errortemplate: parentChart/charts/chart1/templates/deployment.yaml:37:20: executing “parentChart/charts/chart1/templates/deployment.yaml" at <include “copyMyPath” .>: error calling include: template: parentChart/charts/chart1/templates/_helpers.tpl:43:4: executing “copyMyPath" at <include “mypath” "need value">: error calling include: template: parentChart/templates/_helpers.tpl:112:14: executing “mypath” at <.Values.common>: can't evaluate field Values in type string

Am i missing something ?

Idea is i want to refer what's defined in parent chart template

Any help on this really appreciated

I posted the message the message on #helm-users slack channel, but haven't got any response.

Join { to automatically receive all group messages.