Working with Advanced Template Functions
1. Using String Functions
| Function | Example | Result |
repeat | repeat 3 "ab" | ababab |
nospace | nospace "a b c" | abc |
untitle | untitle "Hello World" | hello world |
swapcase | swapcase "AbC" | aBc |
shuffle | shuffle "abc" | random permutation |
indent / nindent | indent 4 . | Prepend N spaces |
wrap N s / wrapWith | Word wrap | Multi-line |
2. Using List Functions
| Function | Use |
list a b c | Build list literal |
first / last / rest / initial | Access ends |
append . v / prepend . v | Add element |
concat l1 l2 | Combine lists |
uniq . | Remove duplicates |
sortAlpha . | Alphabetic sort |
reverse . | Reverse order |
has v . | Contains? |
without . v | Remove element |
slice . i j | Subrange |
compact . | Drop empty entries |
3. Using Dict Functions
| Function | Use |
dict "k1" v1 "k2" v2 | Build map |
get d "k" | Read key (returns empty if missing) |
set d "k" v | Mutate in place; returns dict |
unset d "k" | Remove key |
hasKey d "k" | Boolean |
keys d / values d | Slices |
merge dst src | Shallow merge (dst wins) |
mergeOverwrite dst src | Recursive merge (src wins) |
pick d "k1" "k2" | Subset by keys |
omit d "k1" | Inverse of pick |
deepCopy d | Independent copy |
4. Using Type Functions
| Function | Returns |
typeOf v | Reflect type (e.g. string) |
kindOf v | Kind (map, slice, string, int64, bool...) |
kindIs "map" v | Boolean check |
typeIsLike "string" v | Substring match on type name |
empty v | True for nil/0/""/empty collections |
coalesce a b c | First non-empty value |
5. Using Path Functions
| Function | Use |
base p | Last path element |
dir p | Parent directory |
ext p | File extension |
clean p | Normalize ../ |
isAbs p | Absolute path? |
6. Using Crypto Functions
| Function | Use |
genPrivateKey "rsa" 4096 | RSA/DSA/ECDSA/Ed25519 PEM key |
genCA "ca" 3650 | Self-signed CA cert + key |
genSignedCert "cn" ips dns days ca | Cert signed by CA |
genSelfSignedCert "cn" ips dns days | Self-signed cert |
htpasswd "user" "pass" | bcrypt htpasswd line |
bcrypt "pwd" | bcrypt hash |
derivePassword | Master-password-derived password |
Warning: Crypto functions execute on every render — output changes unless seeded. Use lookup to keep existing secrets stable across upgrades.
7. Using URL Functions
| Function | Use |
urlParse u | Dict with scheme/host/path/query |
urlJoin dict | Build URL from parts |
urlquery s | Query-encode |
8. Using Regex Functions
| Function | Use |
regexMatch pat s | Boolean match |
regexFind pat s | First match |
regexFindAll pat s -1 | All matches |
regexReplaceAll pat s repl | Substitution |
regexSplit pat s -1 | Split into list |
9. Using Sprig Functions
Note: Helm exposes the full
Sprig library — except
env and
expandenv (removed for chart portability/security).
| Category | Examples |
| String | upper, trim, printf, replace |
| Math | add, mul, div, max |
| Date | now, date, ago |
| Lists/Dicts | list, dict, merge |
| Crypto | sha256sum, genCA, bcrypt |
| UUID | uuidv4 |
10. Using Math Functions
| Function | Result |
add a b ... | Sum of integers |
sub a b | Subtraction |
mul a b ... | Product |
div a b | Integer division |
mod a b | Modulo |
max a b ... / min a b ... | Bounds |
floor / ceil / round | Float rounding |
addf / subf / mulf / divf | Float variants |