From 982a6508a9668f475ff7ec3b049ad370a4538748 Mon Sep 17 00:00:00 2001 From: Kirill Ilin Date: Mon, 30 Mar 2026 09:50:08 +0500 Subject: [PATCH] fix(platform): propagate resource allocation ratios to packages Since the bundle restructure in 2d022e38, the cpuAllocationRatio, memoryAllocationRatio and ephemeralStorageAllocationRatio values from platform values.yaml were no longer propagated to child packages. The old monolithic bundles read these values from the cozystack ConfigMap via lookup and passed them explicitly. After migration to the Package CRD model, the bridge was lost: cozy-lib expects the ratios in _cluster config (via cozystack-values Secret), but platform never wrote them there, so the hardcoded defaults were always used. This commit restores the propagation by: - Adding cpu/memory/ephemeral-storage allocation ratios to the _cluster section in the cozystack-values Secret, so cozy-lib in all managed applications picks them up. - Passing cpuAllocationRatio to the kubevirt Package component, so the KubeVirt CR gets the configured value. Assisted-By: Claude AI Signed-off-by: Kirill Ilin (cherry picked from commit b42a8ed7e4e1cfe4d6b6d455727f61c8926b6b84) --- packages/core/platform/templates/apps.yaml | 3 +++ packages/core/platform/templates/bundles/iaas.yaml | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/core/platform/templates/apps.yaml b/packages/core/platform/templates/apps.yaml index 16ef3c35..7ee0de52 100644 --- a/packages/core/platform/templates/apps.yaml +++ b/packages/core/platform/templates/apps.yaml @@ -36,6 +36,9 @@ stringData: branding: {{- . | toYaml | nindent 8 }} {{- end }} + cpu-allocation-ratio: {{ .Values.resources.cpuAllocationRatio | quote }} + memory-allocation-ratio: {{ .Values.resources.memoryAllocationRatio | quote }} + ephemeral-storage-allocation-ratio: {{ .Values.resources.ephemeralStorageAllocationRatio | quote }} {{- with .Values.scheduling }} scheduling: {{- . | toYaml | nindent 8 }} diff --git a/packages/core/platform/templates/bundles/iaas.yaml b/packages/core/platform/templates/bundles/iaas.yaml index 41dc5181..bd002c16 100644 --- a/packages/core/platform/templates/bundles/iaas.yaml +++ b/packages/core/platform/templates/bundles/iaas.yaml @@ -2,7 +2,11 @@ {{- fail "bundles.iaas.enabled can only be true when bundles.system.variant is 'isp-full' or 'isp-full-generic'" }} {{- end }} {{- if and .Values.bundles.iaas.enabled (or (eq .Values.bundles.system.variant "isp-full") (eq .Values.bundles.system.variant "isp-full-generic")) }} -{{include "cozystack.platform.package.default" (list "cozystack.kubevirt" $) }} +{{- $kubevirtComponents := dict -}} +{{- if .Values.resources.cpuAllocationRatio -}} +{{- $_ := set $kubevirtComponents "kubevirt" (dict "values" (dict "cpuAllocationRatio" (.Values.resources.cpuAllocationRatio | int))) -}} +{{- end -}} +{{include "cozystack.platform.package" (list "cozystack.kubevirt" "default" $ $kubevirtComponents) }} {{include "cozystack.platform.package.default" (list "cozystack.kubevirt-cdi" $) }} {{include "cozystack.platform.package.optional.default" (list "cozystack.gpu-operator" $) }} {{include "cozystack.platform.package.default" (list "cozystack.kamaji" $) }}