Commit 15ef839f authored by Mike Lundy's avatar Mike Lundy

[manifests] hoist the regex out of SplitManifests

parent 0a9c16f4
......@@ -23,14 +23,17 @@ import (
"k8s.io/helm/pkg/releaseutil"
)
var (
kindRegex = regexp.MustCompile("kind:(.*)\n")
)
// SplitManifests takes a map of rendered templates and splits them into the
// detected manifests.
func SplitManifests(templates map[string]string) []Manifest {
var listManifests []Manifest
// extract kind and name
re := regexp.MustCompile("kind:(.*)\n")
for k, v := range templates {
match := re.FindStringSubmatch(v)
match := kindRegex.FindStringSubmatch(v)
h := "Unknown"
if len(match) == 2 {
h = strings.TrimSpace(match[1])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment