Skip to content

Commit

Permalink
Merge pull request #1984 from replicatedhq/divolgin/merge
Browse files Browse the repository at this point in the history
merge 1.47.2 fixes
  • Loading branch information
divolgin committed Jul 20, 2021
2 parents 75be664 + 79192c8 commit 806f1c5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions pkg/base/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,16 @@ func (b *Base) writeBase(options WriteOptions, isTopLevelBase bool) ([]string, [
if err != nil {
return nil, nil, errors.Wrapf(err, "failed to render base %s", base.Path)
}
for _, r := range baseResources {
subResources = append(subResources, filepath.Join(base.Path, r))
}
for _, p := range basePatches {
subPatches = append(subPatches, kustomizetypes.PatchStrategicMerge(filepath.Join(base.Path, string(p))))
if base.Namespace == "" {
for _, r := range baseResources {
subResources = append(subResources, filepath.Join(base.Path, r))
}
for _, p := range basePatches {
subPatches = append(subPatches, kustomizetypes.PatchStrategicMerge(filepath.Join(base.Path, string(p))))
}
} else {
kustomizeBases = append(kustomizeBases, base.Path)
}
kustomizeBases = append(kustomizeBases, base.Path)
}

kustomization := kustomizetypes.Kustomization{
Expand All @@ -149,10 +152,9 @@ func (b *Base) writeBase(options WriteOptions, isTopLevelBase bool) ([]string, [
}

if isTopLevelBase && !options.IsHelmBase {
// For the top level base, the one that isn't a helm chart), we remove the "bases" key and move all spec files into the "resources" key.
// We then need to deduplicate resources and split duplicates into "patchesStrategicMerge" key.
// For the top level base, the one that isn't a helm chart), "bases" should contain all charts that are deployed to different namespaces.
// "resources" will then be deduplicated and split into "resources" and "patches", where patches will contain duplicate resources.
// This is done for backwards compatibility with apps that include duplicate resources in different bases.
kustomization.Bases = nil
resources, patches, err := deduplicateResources(append(kustomization.Resources, subResources...), options.BaseDir, options.ExcludeKotsKinds, b.Namespace)
if err != nil {
return nil, nil, errors.Wrapf(err, "failed to defuplicate top level kustomize")
Expand Down

0 comments on commit 806f1c5

Please sign in to comment.