Documentation ¶
Overview ¶
package helmette implements golang analogs for the constructs present within the helm template rendering environment. See also: - https://helm.sh/docs/chart_template_guide/function_list/ - http://masterminds.github.io/sprig/ - https://pkg.golang.ir/text/template
Index ¶
- func Atoi(in string) (int, error)
- func Coalesce[T any](values ...T) T
- func Concat[T any](lists ...[]T) []T
- func Default[T any](default_, value T) T
- func DictTest[K comparable, V any](m map[K]V, key K) (V, bool)
- func Dig(m map[string]any, fallback any, path ...string) any
- func Empty(value any) bool
- func Fail(msg string)
- func First[T any](x []T) any
- func Float64(in string) (float64, error)
- func FromJSON(data string) any
- func HasKey[K comparable, V any](m map[K]V, key K) bool
- func Keys[K comparable, V any](m map[K]V) []K
- func KindIs(kind string, v any) bool
- func KindOf(v any) string
- func Len(in any) int
- func Lookup[T any, PT kube.AddrofObject[T]](dot *Dot, namespace, name string) (obj *T, found bool)
- func Lower(in string) string
- func Merge[K comparable, V any](sources ...map[K]V) map[K]V
- func Min(in ...int) int
- func MustDuration(duration string) *metav1.Duration
- func MustFromJSON(data string) any
- func MustRegexMatch(pattern, s string) bool
- func MustToJSON(value any) string
- func Printf(format string, a ...any) string
- func RegexMatch(pattern, s string) bool
- func Required(msg string, value any)
- func SemverCompare(constraint, version string) (bool, error)
- func SortAlpha(x []string)
- func ToJSON(value any) string
- func ToString(input any) string
- func ToYaml(value any) string
- func Tpl(tpl string, context any) string
- func TrimPrefix(prefix, s string) string
- func TrimSuffix(suffix, s string) string
- func Trunc(length int, in string) string
- func TypeAssertion[T any](val any) T
- func TypeIs(typ string, v any) bool
- func TypeOf(v any) string
- func TypeTest[T any](val any) (T, bool)
- func Unset[K comparable, V any](d map[K]V, key K)
- func Unwrap[T any](from Values) T
- func Upper(in string) string
- type Chart
- type Dot
- type Release
- type Tuple2
- type Tuple3
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Coalesce ¶
func Coalesce[T any](values ...T) T
Coalesce is the go equivalent of sprig's `coalesce`. +gotohelm:builtin=coalesce
func Concat ¶
func Concat[T any](lists ...[]T) []T
Concat is the go equivalent of sprig's `concat`. +gotohelm:builtin=concat
func Default ¶
func Default[T any](default_, value T) T
Default is a go equivalent of sprig's `default`. +gotohelm:builtin=default
func DictTest ¶
func DictTest[K comparable, V any](m map[K]V, key K) (V, bool)
DictTest is an equivalent of `val, ok := map[key]` that is exercised as a function call rather than a special form of syntax. See also: "_shims.dicttest". func DictTest[K comparable, V any](m map[K]V, key K) TestResult[V] {
func Fail ¶
func Fail(msg string)
Fail is the go equivalent of sprig's `fail`. +gotohelm:builtin=fail
func First ¶
First function can not return `T` as sprig implementation will return nil if array is of the size 0.
# Reference https://github.com/Masterminds/sprig/blob/581758eb7d96ae4d113649668fa96acc74d46e7f/list.go#L161-L163 +gotohelm:builtin=first
func HasKey ¶
func HasKey[K comparable, V any](m map[K]V, key K) bool
HasKey is the go equivalent of sprig's `hasKey`. +gotohelm:builtin=hasKey
func Keys ¶
func Keys[K comparable, V any](m map[K]V) []K
Keys is the go equivalent of sprig's `keys`. +gotohelm:builtin=keys
func Lookup ¶
Lookup is a wrapper around helm's builtin lookup function that instead returns `nil, false` if the lookup fails instead of an empty dictionary. See: https://github.com/helm/helm/blob/e24e31f6cc122405ae25069f5b3960036c202c46/pkg/engine/lookup_func.go#L60-L97
func Merge ¶
func Merge[K comparable, V any](sources ...map[K]V) map[K]V
Merge is a go equivalent of sprig's `merge`.
func MustDuration ¶
func MustFromJSON ¶
MustFromJSON is the go equivalent of sprig's `mustFromJson`. +gotohelm:builtin=mustFromJson
func MustRegexMatch ¶
MustRegexMatch is the go equivalent of sprig's `mustRegexMatch`. +gotohelm:builtin=mustRegexMatch
func MustToJSON ¶
MustToJSON is the go equivalent of sprig's `mustToJson`. +gotohelm:builtin=mustToJson
func RegexMatch ¶
RegexMatch is the go equivalent of sprig's `regexMatch`. +gotohelm:builtin=regexMatch
func SemverCompare ¶
+gotohelm:builtin=semverCompare
func SortAlpha ¶
func SortAlpha(x []string)
SortAlpha is the go equivalent of sprig's `sortAlpha` +gotohelm:builtin=sortAlpha
func ToYaml ¶
ToYAML is the go equivalent of helm's `toYaml`.
Reference https://github.com/helm/helm/blob/e90b456d655e78d7c72a32a52a9b70bc1984c33f/pkg/engine/funcs.go#L51 https://github.com/helm/helm/blob/e90b456d655e78d7c72a32a52a9b70bc1984c33f/pkg/engine/funcs.go#L78-L89 +gotohelm:builtin=toYaml
func Tpl ¶
https://helm.sh/docs/howto/charts_tips_and_tricks/#using-the-tpl-function +gotohelm:builtin=tpl
func TrimPrefix ¶
TrimPrefix is the go equivalent of sprig's `trimPrefix` +gotohelm:builtin=trimPrefix
func TrimSuffix ¶
TrimSuffix is the go equivalent of sprig's `trimSuffix` +gotohelm:builtin=trimSuffix
func TypeAssertion ¶
TypeAssertion is an equivalent of `x.(type)` that is exercised as a function call rather than a special form of syntax. See also: "_shims.typeassertion".
func TypeTest ¶
TypeTest is an equivalent of `val, ok := x.(type)` that is exercised as a function call rather than a special form of syntax. See also: "_shims.typetest".
func Unset ¶
func Unset[K comparable, V any](d map[K]V, key K)
Unset is the go equivalent of sprig's `unset`. +gotohelm:builtin=unset
Types ¶
type Dot ¶
type Dot struct { Values Values Release Release Chart Chart // KubeConfig is a hacked in value to allow `Lookup` to not rely on global // values. It's a kube.Config to support JSON marshalling and allow easy // transport into the `go run` test runner. // WARNING: DO NOT USE OR REFERENCE IN HELM CHARTS. IT WILL NOT WORK. KubeConfig kube.Config }
Dot is a representation of the "global" context or `.` in the execution of a helm template. See also: https://github.com/helm/helm/blob/3764b483b385a12e7d3765bff38eced840362049/pkg/chartutil/values.go#L137-L166