mirror of
https://github.com/truenas/charts.git
synced 2026-04-13 17:52:13 +08:00
* Handle longer ints in few places that might have one * add tests * add note * Add some more checking
24 lines
644 B
Smarty
24 lines
644 B
Smarty
{{- define "ix.v1.common.helper.makeIntOrNoop" -}}
|
|
{{- $value := . -}}
|
|
|
|
{{/*
|
|
Ints in Helm can be either int, int64 or float64.
|
|
|
|
Values that start with zero should not be converted
|
|
to int again as this will strip leading zeros.
|
|
|
|
Numbers converted to E notation by Helm will
|
|
always contain the "e" character. So we only
|
|
convert those.
|
|
*/}}
|
|
{{- if and
|
|
(mustHas (kindOf $value) (list "int" "int64" "float64"))
|
|
(not (hasPrefix "0" ($value | toString)))
|
|
(contains "e" ($value | toString | lower))
|
|
-}}
|
|
{{- $value | int -}}
|
|
{{- else -}}
|
|
{{- $value -}}
|
|
{{- end -}}
|
|
{{- end -}}
|