Working with Advanced Template Functions

1. Using String Functions

FunctionExampleResult
repeatrepeat 3 "ab"ababab
nospacenospace "a b c"abc
untitleuntitle "Hello World"hello world
swapcaseswapcase "AbC"aBc
shuffleshuffle "abc"random permutation
indent / nindentindent 4 .Prepend N spaces
wrap N s / wrapWithWord wrapMulti-line

2. Using List Functions

FunctionUse
list a b cBuild list literal
first / last / rest / initialAccess ends
append . v / prepend . vAdd element
concat l1 l2Combine lists
uniq .Remove duplicates
sortAlpha .Alphabetic sort
reverse .Reverse order
has v .Contains?
without . vRemove element
slice . i jSubrange
compact .Drop empty entries

3. Using Dict Functions

FunctionUse
dict "k1" v1 "k2" v2Build map
get d "k"Read key (returns empty if missing)
set d "k" vMutate in place; returns dict
unset d "k"Remove key
hasKey d "k"Boolean
keys d / values dSlices
merge dst srcShallow merge (dst wins)
mergeOverwrite dst srcRecursive merge (src wins)
pick d "k1" "k2"Subset by keys
omit d "k1"Inverse of pick
deepCopy dIndependent copy

4. Using Type Functions

FunctionReturns
typeOf vReflect type (e.g. string)
kindOf vKind (map, slice, string, int64, bool...)
kindIs "map" vBoolean check
typeIsLike "string" vSubstring match on type name
empty vTrue for nil/0/""/empty collections
coalesce a b cFirst non-empty value

5. Using Path Functions

FunctionUse
base pLast path element
dir pParent directory
ext pFile extension
clean pNormalize ../
isAbs pAbsolute path?

6. Using Crypto Functions

FunctionUse
genPrivateKey "rsa" 4096RSA/DSA/ECDSA/Ed25519 PEM key
genCA "ca" 3650Self-signed CA cert + key
genSignedCert "cn" ips dns days caCert signed by CA
genSelfSignedCert "cn" ips dns daysSelf-signed cert
htpasswd "user" "pass"bcrypt htpasswd line
bcrypt "pwd"bcrypt hash
derivePasswordMaster-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

FunctionUse
urlParse uDict with scheme/host/path/query
urlJoin dictBuild URL from parts
urlquery sQuery-encode

8. Using Regex Functions

FunctionUse
regexMatch pat sBoolean match
regexFind pat sFirst match
regexFindAll pat s -1All matches
regexReplaceAll pat s replSubstitution
regexSplit pat s -1Split into list

9. Using Sprig Functions

Note: Helm exposes the full Sprig library — except env and expandenv (removed for chart portability/security).
CategoryExamples
Stringupper, trim, printf, replace
Mathadd, mul, div, max
Datenow, date, ago
Lists/Dictslist, dict, merge
Cryptosha256sum, genCA, bcrypt
UUIDuuidv4

10. Using Math Functions

FunctionResult
add a b ...Sum of integers
sub a bSubtraction
mul a b ...Product
div a bInteger division
mod a bModulo
max a b ... / min a b ...Bounds
floor / ceil / roundFloat rounding
addf / subf / mulf / divfFloat variants