mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-09 14:02:56 +09:00
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:
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 }}
|
||||
|
||||
Reference in new issue
Block a user