fix(kubernetes): use cozy-lib helper for CPU millicore parsing in auto-compute

The auto-compute block used raw `float64` cast on `$effectiveCpu`, which
breaks when the value is in millicore notation like "4000m". Use the
`cozy-lib.resources.toFloat` helper that already handles the `m` suffix.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
This commit is contained in:
Arsolitt committed 2026-04-23 17:02:55 +03:00
1 parent 1702c143db
commit 7fe749e2bb
1 file changed
+2 -1
@@ -212,7 +212,8 @@ metadata:
{{- end }}
{{- $autoReservedMillicores := 50 }}
{{- if $effectiveCpu }}
{{- $effectiveCpuMillis := mulf ($effectiveCpu | float64) 1000.0 | int }}
{{- $effectiveCpuFloat := include "cozy-lib.resources.toFloat" $effectiveCpu | float64 }}
{{- $effectiveCpuMillis := mulf $effectiveCpuFloat 1000.0 | int }}
{{- $fivePercentMillis := mulf ($effectiveCpuMillis | float64) 0.05 | int }}
{{- $autoReservedMillicores = min (max $fivePercentMillis 50) 500 }}
{{- end }}