fixup! fix(v3): Bring back the missing `helm template [-x|--execute] PATH/TO/SINGLE/TEMPLATE`

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
pull/6634/head
Yusuke Kuoka 5 years ago
parent 267528848c
commit 74a2adf6c5

@ -47,7 +47,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
client := action.NewInstall(cfg) client := action.NewInstall(cfg)
valueOpts := &values.Options{} valueOpts := &values.Options{}
var extraAPIs []string var extraAPIs []string
var renderFiles []string var showFiles []string
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "template [NAME] [CHART]", Use: "template [NAME] [CHART]",
@ -76,11 +76,11 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
// if we have a list of files to render, then check that each of the // if we have a list of files to render, then check that each of the
// provided files exists in the chart. // provided files exists in the chart.
if len(renderFiles) > 0 { if len(showFiles) > 0 {
splitManifests := releaseutil.SplitManifests(manifests.String()) splitManifests := releaseutil.SplitManifests(manifests.String())
manifestNameRegex := regexp.MustCompile("# Source: [^/]+/(.+)") manifestNameRegex := regexp.MustCompile("# Source: [^/]+/(.+)")
var manifestsToRender []string var manifestsToRender []string
for _, f := range renderFiles { for _, f := range showFiles {
missing := true missing := true
for _, manifest := range splitManifests { for _, manifest := range splitManifests {
submatch := manifestNameRegex.FindStringSubmatch(manifest) submatch := manifestNameRegex.FindStringSubmatch(manifest)
@ -117,7 +117,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
f := cmd.Flags() f := cmd.Flags()
addInstallFlags(f, client, valueOpts) addInstallFlags(f, client, valueOpts)
f.StringArrayVarP(&renderFiles, "execute", "x", []string{}, "only execute the given templates") f.StringArrayVarP(&showFiles, "show-only", "s", []string{}, "only show manifests rendered from the given templates")
f.StringVar(&client.OutputDir, "output-dir", "", "writes the executed templates to files in output-dir instead of stdout") f.StringVar(&client.OutputDir, "output-dir", "", "writes the executed templates to files in output-dir instead of stdout")
f.BoolVar(&validate, "validate", false, "establish a connection to Kubernetes for schema validation") f.BoolVar(&validate, "validate", false, "establish a connection to Kubernetes for schema validation")
f.StringArrayVarP(&extraAPIs, "api-versions", "a", []string{}, "Kubernetes api versions used for Capabilities.APIVersions") f.StringArrayVarP(&extraAPIs, "api-versions", "a", []string{}, "Kubernetes api versions used for Capabilities.APIVersions")

Loading…
Cancel
Save