Skip to content

Commit 75839a8

Browse files
committed
fix: namespace is not correctly propagate with nested kustomization files
1 parent 9376a5c commit 75839a8

File tree

2 files changed

+339
-41
lines changed

2 files changed

+339
-41
lines changed

api/internal/target/kusttarget.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,11 @@ func (kt *KustTarget) accumulateDirectory(
496496
}
497497
subKt.kustomization.BuildMetadata = kt.kustomization.BuildMetadata
498498
subKt.origin = kt.origin
499+
// Propagate namespace to child kustomization if child doesn't have one
500+
// This ensures Helm charts in base kustomizations inherit namespace from overlays
501+
if subKt.kustomization.Namespace == "" && kt.kustomization.Namespace != "" {
502+
subKt.kustomization.Namespace = kt.kustomization.Namespace
503+
}
499504
var bytes []byte
500505
if openApiPath, exists := subKt.Kustomization().OpenAPI["path"]; exists {
501506
bytes, err = ldr.Load(openApiPath)

0 commit comments

Comments
 (0)