-
Bug
-
Resolution: Done
-
Minor
-
None
-
4.18.0
-
None
-
Quality / Stability / Reliability
-
False
-
-
3
-
Low
-
None
-
-
None
-
None
-
T&PS 2025 #4, T&PS 2025 #5, T&PS 2025 #6
-
3
-
In Progress
-
Release Note Not Required
-
None
-
None
-
None
-
None
-
None
Description of problem:
There is currently no documentation or CLI subcommand/help to list the allowed template functions that can be used in a reference template. It would be very useful to know which template functions are available in the current release of the cluster-compare plugin. https://github.com/openshift/kube-compare/blob/bf4ee341844cdd3da7b9b3ed92858a8d72cabb29/pkg/compare/funcmap.go#L21-L58
Version-Release number of selected component (if applicable):
4.18
Cluster-compare 4.19 adds a commandline option to describe the allowed template functions, and here is the output for 4.19:
$ oc cluster-compare --show-template-functions Available Template Functions ============================ doNotMatch: Skip matching this target against the current CR fromJson: Parse the incoming string as a structured JSON object fromJsonArray: Parse the incoming string as a structured JSON array fromYaml: Parse the incoming string as a structured YAML object fromYamlArray: Parse the incoming string as a structured YAML array lookupCR: Lookup an external CR and return exactly one matching object lookupCRs: Lookup an external CR and return an array of matching objects toJson: Render incoming data of any type as a JSON string toToml: Render incoming data of any type as a TOML document string toYaml: Render incoming data of any type as a YAML document string Imported from https://masterminds.github.io/sprig/ -------------------------------------------------- abbrev, abbrevboth, add, add1, add1f, addf, adler32sum, ago, all, any, append, atoi, b32dec, b32enc, b64dec, b64enc, base, bcrypt, biggest, buildCustomCert, camelcase, cat, ceil, chunk, clean, coalesce, compact, concat, contains, date, dateInZone, dateModify, date_in_zone, date_modify, decryptAES, deepCopy, deepEqual, default, derivePassword, dict, dig, dir, div, divf, duration, durationRound, empty, encryptAES, ext, fail, first, float64, floor, genCA, genCAWithKey, genPrivateKey, genSelfSignedCert, genSelfSignedCertWithKey, genSignedCert, genSignedCertWithKey, get, getHostByName, has, hasKey, hasPrefix, hasSuffix, hello, htmlDate, htmlDateInZone, htpasswd, indent, initial, initials, int, int64, isAbs, join, kebabcase, keys, kindIs, kindOf, last, list, lower, max, maxf, merge, mergeOverwrite, min, minf, mod, mul, mulf, mustAppend, mustChunk, mustCompact, mustDateModify, mustDeepCopy, mustFirst, mustFromJson, mustHas, mustInitial, mustLast, mustMerge, mustMergeOverwrite, mustPrepend, mustPush, mustRegexFind, mustRegexFindAll, mustRegexMatch, mustRegexReplaceAll, mustRegexReplaceAllLiteral, mustRegexSplit, mustRest, mustReverse, mustSlice, mustToDate, mustToJson, mustToPrettyJson, mustToRawJson, mustUniq, mustWithout, must_date_modify, nindent, nospace, now, omit, osBase, osClean, osDir, osExt, osIsAbs, pick, pluck, plural, prepend, push, quote, randAlpha, randAlphaNum, randAscii, randBytes, randInt, randNumeric, regexFind, regexFindAll, regexMatch, regexQuoteMeta, regexReplaceAll, regexReplaceAllLiteral, regexSplit, repeat, replace, rest, reverse, round, semver, semverCompare, seq, set, sha1sum, sha256sum, sha512sum, shuffle, slice, snakecase, sortAlpha, split, splitList, splitn, squote, sub, subf, substr, swapcase, ternary, title, toDate, toDecimal, toPrettyJson, toRawJson, toString, toStrings, trim, trimAll, trimPrefix, trimSuffix, trimall, trunc, tuple, typeIs, typeIsLike, typeOf, uniq, unixEpoch, unset, until, untilStep, untitle, upper, urlJoin, urlParse, uuidv4, values, without, wrap, wrapWith
For 4.18, we will not backport the commandline option, but the set of template functions in 4.18 is:
Available Template Functions ============================ fromJson: Parse the incoming string as a structured JSON object fromJsonArray: Parse the incoming string as a structured JSON array fromYaml: Parse the incoming string as a structured YAML object fromYamlArray: Parse the incoming string as a structured YAML array toJson: Render incoming data of any type as a JSON string toToml: Render incoming data of any type as a TOML document string toYaml: Render incoming data of any type as a YAML document string Imported from https://masterminds.github.io/sprig/ -------------------------------------------------- abbrev, abbrevboth, add, add1, add1f, addf, adler32sum, ago, all, any, append, atoi, b32dec, b32enc, b64dec, b64enc, base, bcrypt, biggest, buildCustomCert, camelcase, cat, ceil, chunk, clean, coalesce, compact, concat, contains, date, dateInZone, dateModify, date_in_zone, date_modify, decryptAES, deepCopy, deepEqual, default, derivePassword, dict, dig, dir, div, divf, duration, durationRound, empty, encryptAES, ext, fail, first, float64, floor, genCA, genCAWithKey, genPrivateKey, genSelfSignedCert, genSelfSignedCertWithKey, genSignedCert, genSignedCertWithKey, get, getHostByName, has, hasKey, hasPrefix, hasSuffix, hello, htmlDate, htmlDateInZone, htpasswd, indent, initial, initials, int, int64, isAbs, join, kebabcase, keys, kindIs, kindOf, last, list, lower, max, maxf, merge, mergeOverwrite, min, minf, mod, mul, mulf, mustAppend, mustChunk, mustCompact, mustDateModify, mustDeepCopy, mustFirst, mustFromJson, mustHas, mustInitial, mustLast, mustMerge, mustMergeOverwrite, mustPrepend, mustPush, mustRegexFind, mustRegexFindAll, mustRegexMatch, mustRegexReplaceAll, mustRegexReplaceAllLiteral, mustRegexSplit, mustRest, mustReverse, mustSlice, mustToDate, mustToJson, mustToPrettyJson, mustToRawJson, mustUniq, mustWithout, must_date_modify, nindent, nospace, now, omit, osBase, osClean, osDir, osExt, osIsAbs, pick, pluck, plural, prepend, push, quote, randAlpha, randAlphaNum, randAscii, randBytes, randInt, randNumeric, regexFind, regexFindAll, regexMatch, regexQuoteMeta, regexReplaceAll, regexReplaceAllLiteral, regexSplit, repeat, replace, rest, reverse, round, semver, semverCompare, seq, set, sha1sum, sha256sum, sha512sum, shuffle, slice, snakecase, sortAlpha, split, splitList, splitn, squote, sub, subf, substr, swapcase, ternary, title, toDate, toDecimal, toPrettyJson, toRawJson, toString, toStrings, trim, trimAll, trimPrefix, trimSuffix, trimall, trunc, tuple, typeIs, typeIsLike, typeOf, uniq, unixEpoch, unset, until, untilStep, untitle, upper, urlJoin, urlParse, uuidv4, values, without, wrap, wrapWith
Or in other words, 4.18 has the same set of template functions with the exception of "doNotMatch", "lookupCRs" and "lookupCR"
- clones
-
OCPBUGS-54676 There is no listing of allowed template functions
-
- Closed
-
- relates to
-
OCPBUGS-54588 Cluster compare misses templates customization explanations and examples
-
- Closed
-
- links to