I have my own helm chart and I'm trying to perform split without using the _helpers.tpl
in one line
my values.yaml
file content:
deployment:
domain: my.domain
I need to split domain name in my template file: my.domain
I have tried to perform this by using the following syntax:
name regex (.*)\.{{ (split .Values.deployment.domain ".")._0 }}\.{{ (split .Values.deployment.domain ".")._1 }}
or
{{- $split := .Values.deployment.domain "." . }}
name regex (.*)\.{{ first split }}\.{{ second split }}
But nothing worked
I'm trying to get the following results in my template file:
name regex (.*)\.my\.domain
Helm uses the sprig library to provide lots of data manipulation functions, have a look at their docs for strings. You can use the {{ split }} function to do what you want.
$parts := split "." .Values.deployment.domain
$parts._0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With