Is there any substring function in helm chart yaml templates ?

8/7/2018

How can I substring a string like /com/app1/main to get the value of main in a HELM template ?

-- FreshMike
kubernetes
kubernetes-helm

2 Answers

8/7/2018

You can use the regexFind function in helm

regexFind "[^/]+

quot; "/com/app1/main"

Will get the text following the last /

-- Curtis Allen
Source: StackOverflow

8/7/2018

Helm uses the sprig library to provide lots of data manipulation functions, have a look at their docs. You can use the {{ base }} function to do what you want.

-- Marcin Romaszewicz
Source: StackOverflow