Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use templates inside templates in helm chart?

I want to use template inside template with "." operator in my helm chart.

Suppose this is my values.yaml

component: my-component
my-component-arguments:
  heap_opts: "heap-opts" 

Now I want to get "heap_opts", but component name is dynamic. How can I do something like this using template?

{{ .Values."{{.Values.component}}-arguments".heap_opts }}
like image 796
Ayush walia Avatar asked Dec 20 '25 12:12

Ayush walia


1 Answers

You can do this using get spring function combined with index and printf from text/template package

{{ get (index .Values (printf "%s-arguments" .Values.component)) "heap_opts" }} 
like image 164
edbighead Avatar answered Dec 24 '25 09:12

edbighead



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!