From ef9802f514bfe237da4a860dcee309eaa610324e Mon Sep 17 00:00:00 2001 From: Ali Rizwan Date: Wed, 14 Mar 2018 12:47:16 +0100 Subject: [PATCH 1/2] Allow Helm create starters option to use paths Updated docs to reflect changes --- cmd/helm/create.go | 9 ++++++++- docs/charts.md | 4 +--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/helm/create.go b/cmd/helm/create.go index 556ff171d..cc2200e50 100644 --- a/cmd/helm/create.go +++ b/cmd/helm/create.go @@ -20,6 +20,7 @@ import ( "errors" "fmt" "io" + "os" "path/filepath" "github.com/spf13/cobra" @@ -78,7 +79,7 @@ func newCreateCmd(out io.Writer) *cobra.Command { }, } - cmd.Flags().StringVarP(&cc.starter, "starter", "p", "", "the named Helm starter scaffold") + cmd.Flags().StringVarP(&cc.starter, "starter", "p", "", "the name or path of the Helm starter scaffold") return cmd } @@ -97,6 +98,12 @@ func (c *createCmd) run() error { if c.starter != "" { // Create from the starter lstarter := filepath.Join(c.home.Starters(), c.starter) + // Check without helm home + if _, err := os.Stat(lstarter); os.IsNotExist(err) { + if _, err := os.Stat(c.starter); err == nil { + lstarter = c.starter + } + } return chartutil.CreateFrom(cfile, filepath.Dir(c.name), lstarter) } diff --git a/docs/charts.md b/docs/charts.md index 8722e6862..4e1dc6afc 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -843,6 +843,7 @@ The `helm create` command takes an optional `--starter` option that lets you specify a "starter chart". Starters are just regular charts, but are located in `$HELM_HOME/starters`. +You can specify the path to a starter using the `--starter` option. As a chart developer, you may author charts that are specifically designed to be used as starters. Such charts should be designed with the following considerations in mind: @@ -853,6 +854,3 @@ considerations in mind: - All occurences of `` will be replaced with the specified chart name so that starter charts can be used as templates. -Currently the only way to add a chart to `$HELM_HOME/starters` is to manually -copy it there. In your chart's documentation, you may want to explain that -process. From 72141413f130b01667d957d4bdb8bc8c49d26fc4 Mon Sep 17 00:00:00 2001 From: Ali Rizwan Date: Wed, 14 Mar 2018 13:10:32 +0100 Subject: [PATCH 2/2] Update docs --- docs/helm/helm_create.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/helm/helm_create.md b/docs/helm/helm_create.md index 6e0f3de78..88b0b52ae 100644 --- a/docs/helm/helm_create.md +++ b/docs/helm/helm_create.md @@ -37,7 +37,7 @@ helm create NAME ### Options ``` - -p, --starter string the named Helm starter scaffold + -p, --starter string the name or path of the Helm starter scaffold ``` ### Options inherited from parent commands @@ -54,4 +54,4 @@ helm create NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 14-Mar-2018