urlaubsverwaltung: NOTES.txt and the exponential-quantity fix (8.1.0+up6.7.0)
Teil von #157 und Teil von #43. #157: multiplyQuantity turned a bare byte count into exponential notation. Values pass through fromYaml, which parses every number as float64, and Go's "%v" switches float64 to exponential notation from about 1e6 upwards. Both places that stringify a number now go through the new formatNumber helper - the input of multiplyQuantity, which aborted the render with an unsupported suffix "e+06", and the output of a non-integer product, which did not abort at all but rendered an invalid quantity that only the API server rejects. Measured on this chart against ci/urlaubsverwaltung/test-values.yaml: requests.memory=1048576 before: abort, suffix "e+06" after: request 1048576, limit "3145728" requests.ephemeralStorage=2097152 before: abort, suffix "e+06" after: limit "6291456" memory=999999, limitFactor=1.5 before: limit "1.4999985e+06", no abort after: limit "1499998.5" requests.memory=65536 (regression) 196608 before and after The correction is the canonical one, word for word as merged into template-chart, voucher-vault and zipline; only the helper prefix differs. urlaubsverwaltung has a single resources path and a single render site (the Deployment), and both were verified. #43: adds a NOTES.txt. Its content was verified against a running release in a throwaway k3d cluster rather than taken from upstream documentation - the identity provider being resolved at boot (a bad issuer-uri crashlooops the pod instead of breaking the login), the buildpack sizing the JVM heap from the computed memory limit, /actuator/health answering 503 for the lifetime of the release because the chart points the mail sender at localhost:1025, the probe groups not reacting to a database outage, and a name collision in urlaubsverwaltung.env making the next helm upgrade fail on the patch order. README.md is deliberately untouched: the line listing the charts that ship a NOTES.txt collides with every parallel NOTES PR and is pulled up once at the end of the programme. Minor bump: a NOTES.txt renders no Kubernetes object and the quantity fix changes no default. appVersion unchanged.
This commit is contained in:
3 files changed
+291
-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 "urlaubsverwaltung.multiplyQuantity" -}}
|
||||
{{- $quantity := printf "%v" .quantity -}}
|
||||
{{- $quantity := include "urlaubsverwaltung.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 "urlaubsverwaltung.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 "urlaubsverwaltung.formatNumber" -}}
|
||||
{{- if kindIs "float64" . -}}
|
||||
{{- regexReplaceAll "\\.?0+$" (printf "%.10f" .) "" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%v" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
Reference in new issue
Block a user