use sprig join for template functions

This commit is contained in:
Bronson Mirafuentes 2022-11-15 08:59:05 -08:00
parent 591fbf856a
commit 5a3ed44773
2 changed files with 3 additions and 5 deletions

View File

@ -77,13 +77,13 @@ data:
ttl 30
}
{{- if GossipDomains }}
hosts /rootfs/etc/hosts {{ join GossipDomains " " }} {
hosts /rootfs/etc/hosts {{ join " " GossipDomains }} {
ttl 30
fallthrough
}
{{- end }}
prometheus :9153
forward . {{ or (join KubeDNS.UpstreamNameservers " ") "/etc/resolv.conf" }} {
forward . {{ or (join " " KubeDNS.UpstreamNameservers) "/etc/resolv.conf" }} {
max_concurrent 1000
}
cache 30

View File

@ -91,9 +91,6 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap, secretStore fi.SecretS
dest["replace"] = func(s, find, replace string) string {
return strings.Replace(s, find, replace, -1)
}
dest["join"] = func(a []string, sep string) string {
return strings.Join(a, sep)
}
dest["joinHostPort"] = net.JoinHostPort
sprigTxtFuncMap := sprig.TxtFuncMap()
@ -103,6 +100,7 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap, secretStore fi.SecretS
dest["trimPrefix"] = sprigTxtFuncMap["trimPrefix"]
dest["semverCompare"] = sprigTxtFuncMap["semverCompare"]
dest["ternary"] = sprigTxtFuncMap["ternary"]
dest["join"] = sprigTxtFuncMap["join"]
dest["ClusterName"] = tf.ClusterName
dest["WithDefaultBool"] = func(v *bool, defaultValue bool) bool {