rallly: NOTES.txt and the #157 number formatting (8.1.0+up4.13.0)
Two additive changes in one release. multiplyQuantity turned a bare integer resource value of about 1e6 or more into exponential notation and aborted the render with "unsupported resource quantity suffix \"e+06\"". The null-safe helpers from #99 pass values through fromYaml, which parses every number as float64, and Go's "%v" switches those to exponential form. The new rallly.formatNumber helper forces plain decimal notation on both the input and the non-integer product; it is the same wording already merged into template-chart, zipline and voucher-vault. The NOTES.txt prints what an operator would otherwise have to read out of the templates: the rendered access URL or the port-forward command, the fields each 1Password item has to carry, the OIDC redirect URI, and the traps of this chart - OIDC is the only way in because email login and registration are hard-coded off, a rotated 1Password item does not restart the pods, the probes only prove that the web process answers, and the Next.js cache emptyDir counts against the container's ephemeral-storage limit. Part of #157 Part of #43
This commit is contained in:
3 files changed
+215
-3
No files matched your search
@@ -67,7 +67,7 @@ Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
|
||||
results are printed without a decimal point.
|
||||
*/}}
|
||||
{{- define "rallly.multiplyQuantity" -}}
|
||||
{{- $quantity := printf "%v" .quantity -}}
|
||||
{{- $quantity := include "rallly.formatNumber" .quantity -}}
|
||||
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
|
||||
{{- if not $number -}}
|
||||
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
|
||||
@@ -80,7 +80,24 @@ results are printed without a decimal point.
|
||||
{{- if eq $product (floor $product) -}}
|
||||
{{- printf "%d%s" (int64 $product) $suffix -}}
|
||||
{{- else -}}
|
||||
{{- printf "%v%s" $product $suffix -}}
|
||||
{{- printf "%s%s" (include "rallly.formatNumber" $product) $suffix -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Render a number as a plain decimal string, never in exponential notation.
|
||||
|
||||
Why this exists (issue #157): the null-safe fallback helpers pass values
|
||||
through fromYaml, which parses every number as float64. Go's "%v" switches
|
||||
float64 to exponential notation from about 1e6 upwards, so a bare byte count
|
||||
like 1048576 became "1.048576e+06" - not a valid Kubernetes quantity, and the
|
||||
render aborted. Strings ("512Mi") are passed through untouched.
|
||||
*/}}
|
||||
{{- define "rallly.formatNumber" -}}
|
||||
{{- if kindIs "float64" . -}}
|
||||
{{- regexReplaceAll "\\.?0+$" (printf "%.10f" .) "" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%v" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
Reference in new issue
Block a user