From 7fe749e2bb8a1d8a751fd04723ebc370b07a2c81 Mon Sep 17 00:00:00 2001 From: Arsolitt Date: Wed, 22 Apr 2026 17:19:57 +0300 Subject: [PATCH] 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 --- packages/apps/kubernetes/templates/cluster.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/apps/kubernetes/templates/cluster.yaml b/packages/apps/kubernetes/templates/cluster.yaml index 6f1c324d2..5ca249762 100644 --- a/packages/apps/kubernetes/templates/cluster.yaml +++ b/packages/apps/kubernetes/templates/cluster.yaml @@ -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 }}