Skip to content

Commit c7612d1

Browse files
committed
fix: performance recession when propagating namespace to helm
1 parent 3908634 commit c7612d1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

api/internal/target/kusttarget.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,13 @@ func (kt *KustTarget) MakeCustomizedResMap() (resmap.ResMap, error) {
127127
}
128128

129129
func (kt *KustTarget) makeCustomizedResMap() (resmap.ResMap, error) {
130-
// Track origin for all resources so builtins can make decisions
131-
// based on where resources originated from.
132-
// Origin annotations will be stripped from the output if not
133-
// requested via build metadata options.
134-
kt.origin = &resource.Origin{}
130+
// Only track origin if we have Helm charts or build metadata is requested
131+
// This optimization avoids unnecessary overhead when origins aren't needed
132+
var origin *resource.Origin
133+
if len(kt.kustomization.BuildMetadata) != 0 || len(kt.kustomization.HelmCharts) > 0 {
134+
origin = &resource.Origin{}
135+
}
136+
kt.origin = origin
135137
ra, err := kt.AccumulateTarget()
136138
if err != nil {
137139
return nil, err

0 commit comments

Comments
 (0)