From d5bfb706b384eeab0f072516754a0d087e326cb1 Mon Sep 17 00:00:00 2001 From: antyagi Date: Wed, 18 Feb 2026 15:04:47 +0530 Subject: [PATCH] feat: helm performance improvement by deep copying coalesce globals Signed-off-by: antyagi --- pkg/chart/common/util/coalesce.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/chart/common/util/coalesce.go b/pkg/chart/common/util/coalesce.go index 5994febbc..d8f10a7e8 100644 --- a/pkg/chart/common/util/coalesce.go +++ b/pkg/chart/common/util/coalesce.go @@ -19,7 +19,6 @@ package util import ( "fmt" "log" - "maps" "helm.sh/helm/v4/internal/copystructure" chart "helm.sh/helm/v4/pkg/chart" @@ -160,7 +159,8 @@ func coalesceGlobals(printf printFn, dest, src map[string]any, prefix string, _ // tables in globals. for key, val := range sg { if istable(val) { - vv := copyMap(val.(map[string]any)) + valCopy, _ := copystructure.Copy(val) + vv := valCopy.(map[string]interface{}) if destv, ok := dg[key]; !ok { // Here there is no merge. We're just adding. dg[key] = vv @@ -189,11 +189,6 @@ func coalesceGlobals(printf printFn, dest, src map[string]any, prefix string, _ dest[common.GlobalKey] = dg } -func copyMap(src map[string]any) map[string]any { - m := make(map[string]any, len(src)) - maps.Copy(m, src) - return m -} // coalesceValues builds up a values map for a particular chart. //