From d6480c0b7304283a47c09dd773ff261566597a7e Mon Sep 17 00:00:00 2001 From: Mike Lundy Date: Thu, 25 Oct 2018 11:12:15 -0700 Subject: [PATCH] [manifest] teach splitter to handle multiple manifests per file Signed-off-by: Mike Lundy --- pkg/helm/fake_test.go | 4 +--- pkg/manifest/splitter.go | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/helm/fake_test.go b/pkg/helm/fake_test.go index 4376742d7..967905701 100644 --- a/pkg/helm/fake_test.go +++ b/pkg/helm/fake_test.go @@ -51,9 +51,7 @@ data: Revision: %d Service: Tiller Time: - seconds: 242085845 - -` + seconds: 242085845` ) var installChart *chart.Chart diff --git a/pkg/manifest/splitter.go b/pkg/manifest/splitter.go index 7081e7aa7..38cec2742 100644 --- a/pkg/manifest/splitter.go +++ b/pkg/manifest/splitter.go @@ -31,15 +31,17 @@ var ( // detected manifests. func SplitManifests(templates map[string]string) []Manifest { var listManifests []Manifest - // extract kind and name - for k, v := range templates { - match := kindRegex.FindStringSubmatch(v) - h := "Unknown" - if len(match) == 2 { - h = strings.TrimSpace(match[1]) + for k, fileContent := range templates { + for _, manifestContent := range releaseutil.SplitManifests(fileContent) { + // extract kind and name + match := kindRegex.FindStringSubmatch(manifestContent) + h := "Unknown" + if len(match) == 2 { + h = strings.TrimSpace(match[1]) + } + m := Manifest{Name: k, Content: manifestContent, Head: &releaseutil.SimpleHead{Kind: h}} + listManifests = append(listManifests, m) } - m := Manifest{Name: k, Content: v, Head: &releaseutil.SimpleHead{Kind: h}} - listManifests = append(listManifests, m) } return listManifests