diff --git a/cmd/helm/create.go b/cmd/helm/create.go index ffaa67d2c56115c15ea205157d5ac76422fbbb59..1300b68aaaa13838278f05c5694de5527510a0c3 100644 --- a/cmd/helm/create.go +++ b/cmd/helm/create.go @@ -71,7 +71,7 @@ func newCreateCmd(out io.Writer) *cobra.Command { Short: "create a new chart with the given name", Long: createDesc, RunE: func(cmd *cobra.Command, args []string) error { - cc.home = helmpath.Home(homePath()) + cc.home = settings.Home if len(args) == 0 { return errors.New("the name of the new chart is required") } diff --git a/cmd/helm/create_test.go b/cmd/helm/create_test.go index 50cf3b6db69b7ae38aa0c81b87222b3fff5db203..a49d3cfa9e43e42e391c51fa781e368976d65cc6 100644 --- a/cmd/helm/create_test.go +++ b/cmd/helm/create_test.go @@ -23,6 +23,8 @@ import ( "testing" "k8s.io/helm/pkg/chartutil" + "k8s.io/helm/pkg/helm/environment" + "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/proto/hapi/chart" ) @@ -85,15 +87,15 @@ func TestCreateStarterCmd(t *testing.T) { if err != nil { t.Fatal(err) } - old := homePath() - helmHome = thome + old := helmpath.Home(environment.DefaultHelmHome()) + settings.Home = thome defer func() { - helmHome = old - os.RemoveAll(thome) + settings.Home = old + os.RemoveAll(thome.String()) }() // Create a starter. - starterchart := filepath.Join(thome, "starters") + starterchart := filepath.Join(thome.String(), "starters") os.Mkdir(starterchart, 0755) if dest, err := chartutil.Create(&chart.Metadata{Name: "starterchart"}, starterchart); err != nil { t.Fatalf("Could not create chart: %s", err) diff --git a/cmd/helm/dependency_build.go b/cmd/helm/dependency_build.go index 8e8c73062d31ae82e8af4f7a06fd23041cdc7b9a..3a92edd07b3335b81974f4a3fe9a4322797a5c46 100644 --- a/cmd/helm/dependency_build.go +++ b/cmd/helm/dependency_build.go @@ -21,6 +21,7 @@ import ( "github.com/spf13/cobra" "k8s.io/helm/pkg/downloader" + "k8s.io/helm/pkg/getter/defaultgetters" "k8s.io/helm/pkg/helm/helmpath" ) @@ -53,7 +54,7 @@ func newDependencyBuildCmd(out io.Writer) *cobra.Command { Short: "rebuild the charts/ directory based on the requirements.lock file", Long: dependencyBuildDesc, RunE: func(cmd *cobra.Command, args []string) error { - dbc.helmhome = helmpath.Home(homePath()) + dbc.helmhome = settings.Home dbc.chartpath = "." if len(args) > 0 { @@ -76,6 +77,7 @@ func (d *dependencyBuildCmd) run() error { ChartPath: d.chartpath, HelmHome: d.helmhome, Keyring: d.keyring, + Getters: defaultgetters.Get(settings), } if d.verify { man.Verify = downloader.VerifyIfPossible diff --git a/cmd/helm/dependency_build_test.go b/cmd/helm/dependency_build_test.go index 4dc170b9e99aa586ad08c69678a5a872e2a5733a..0ea073fd0b407849cd8c909e5213f8c11793c769 100644 --- a/cmd/helm/dependency_build_test.go +++ b/cmd/helm/dependency_build_test.go @@ -29,18 +29,18 @@ import ( ) func TestDependencyBuildCmd(t *testing.T) { - oldhome := helmHome + oldhome := settings.Home hh, err := tempHelmHome(t) if err != nil { t.Fatal(err) } - helmHome = hh + settings.Home = hh defer func() { - os.RemoveAll(hh) - helmHome = oldhome + os.RemoveAll(hh.String()) + settings.Home = oldhome }() - srv := repotest.NewServer(hh) + srv := repotest.NewServer(hh.String()) defer srv.Stop() _, err = srv.CopyCharts("testdata/testcharts/*.tgz") if err != nil { @@ -48,14 +48,14 @@ func TestDependencyBuildCmd(t *testing.T) { } chartname := "depbuild" - if err := createTestingChart(hh, chartname, srv.URL()); err != nil { + if err := createTestingChart(hh.String(), chartname, srv.URL()); err != nil { t.Fatal(err) } out := bytes.NewBuffer(nil) dbc := &dependencyBuildCmd{out: out} dbc.helmhome = helmpath.Home(hh) - dbc.chartpath = filepath.Join(hh, chartname) + dbc.chartpath = filepath.Join(hh.String(), chartname) // In the first pass, we basically want the same results as an update. if err := dbc.run(); err != nil { @@ -70,14 +70,14 @@ func TestDependencyBuildCmd(t *testing.T) { } // Make sure the actual file got downloaded. - expect := filepath.Join(hh, chartname, "charts/reqtest-0.1.0.tgz") + expect := filepath.Join(hh.String(), chartname, "charts/reqtest-0.1.0.tgz") if _, err := os.Stat(expect); err != nil { t.Fatal(err) } // In the second pass, we want to remove the chart's request dependency, // then see if it restores from the lock. - lockfile := filepath.Join(hh, chartname, "requirements.lock") + lockfile := filepath.Join(hh.String(), chartname, "requirements.lock") if _, err := os.Stat(lockfile); err != nil { t.Fatal(err) } @@ -92,7 +92,7 @@ func TestDependencyBuildCmd(t *testing.T) { } // Now repeat the test that the dependency exists. - expect = filepath.Join(hh, chartname, "charts/reqtest-0.1.0.tgz") + expect = filepath.Join(hh.String(), chartname, "charts/reqtest-0.1.0.tgz") if _, err := os.Stat(expect); err != nil { t.Fatal(err) } diff --git a/cmd/helm/dependency_update.go b/cmd/helm/dependency_update.go index e361ae1c680270f841ea7696b314d619dd1a4f5f..bd2183cff75b94e5460b8f44a262125ef0f2451f 100644 --- a/cmd/helm/dependency_update.go +++ b/cmd/helm/dependency_update.go @@ -21,6 +21,7 @@ import ( "github.com/spf13/cobra" "k8s.io/helm/pkg/downloader" + "k8s.io/helm/pkg/getter/defaultgetters" "k8s.io/helm/pkg/helm/helmpath" ) @@ -72,7 +73,7 @@ func newDependencyUpdateCmd(out io.Writer) *cobra.Command { return err } - duc.helmhome = helmpath.Home(homePath()) + duc.helmhome = settings.Home return duc.run() }, @@ -94,11 +95,12 @@ func (d *dependencyUpdateCmd) run() error { HelmHome: d.helmhome, Keyring: d.keyring, SkipUpdate: d.skipRefresh, + Getters: defaultgetters.Get(settings), } if d.verify { man.Verify = downloader.VerifyIfPossible } - if flagDebug { + if settings.FlagDebug { man.Debug = true } return man.Update() diff --git a/cmd/helm/dependency_update_test.go b/cmd/helm/dependency_update_test.go index c3b638a3f641631d5c630efbefe93264adb5e483..6e7f2fd3c2150d624aa795af9b64587eaaadc8d3 100644 --- a/cmd/helm/dependency_update_test.go +++ b/cmd/helm/dependency_update_test.go @@ -35,18 +35,18 @@ import ( func TestDependencyUpdateCmd(t *testing.T) { // Set up a testing helm home - oldhome := helmHome + oldhome := settings.Home hh, err := tempHelmHome(t) if err != nil { t.Fatal(err) } - helmHome = hh + settings.Home = hh defer func() { - os.RemoveAll(hh) - helmHome = oldhome + os.RemoveAll(hh.String()) + settings.Home = oldhome }() - srv := repotest.NewServer(hh) + srv := repotest.NewServer(hh.String()) defer srv.Stop() copied, err := srv.CopyCharts("testdata/testcharts/*.tgz") if err != nil { @@ -56,14 +56,14 @@ func TestDependencyUpdateCmd(t *testing.T) { t.Logf("Listening on directory %s", srv.Root()) chartname := "depup" - if err := createTestingChart(hh, chartname, srv.URL()); err != nil { + if err := createTestingChart(hh.String(), chartname, srv.URL()); err != nil { t.Fatal(err) } out := bytes.NewBuffer(nil) duc := &dependencyUpdateCmd{out: out} duc.helmhome = helmpath.Home(hh) - duc.chartpath = filepath.Join(hh, chartname) + duc.chartpath = filepath.Join(hh.String(), chartname) if err := duc.run(); err != nil { output := out.String() @@ -78,7 +78,7 @@ func TestDependencyUpdateCmd(t *testing.T) { } // Make sure the actual file got downloaded. - expect := filepath.Join(hh, chartname, "charts/reqtest-0.1.0.tgz") + expect := filepath.Join(hh.String(), chartname, "charts/reqtest-0.1.0.tgz") if _, err := os.Stat(expect); err != nil { t.Fatal(err) } @@ -106,7 +106,7 @@ func TestDependencyUpdateCmd(t *testing.T) { {Name: "compressedchart", Version: "0.3.0", Repository: srv.URL()}, }, } - dir := filepath.Join(hh, chartname) + dir := filepath.Join(hh.String(), chartname) if err := writeRequirements(dir, reqfile); err != nil { t.Fatal(err) } @@ -118,11 +118,11 @@ func TestDependencyUpdateCmd(t *testing.T) { // In this second run, we should see compressedchart-0.3.0.tgz, and not // the 0.1.0 version. - expect = filepath.Join(hh, chartname, "charts/compressedchart-0.3.0.tgz") + expect = filepath.Join(hh.String(), chartname, "charts/compressedchart-0.3.0.tgz") if _, err := os.Stat(expect); err != nil { t.Fatalf("Expected %q: %s", expect, err) } - dontExpect := filepath.Join(hh, chartname, "charts/compressedchart-0.1.0.tgz") + dontExpect := filepath.Join(hh.String(), chartname, "charts/compressedchart-0.1.0.tgz") if _, err := os.Stat(dontExpect); err == nil { t.Fatalf("Unexpected %q", dontExpect) } @@ -130,18 +130,18 @@ func TestDependencyUpdateCmd(t *testing.T) { func TestDependencyUpdateCmd_SkipRefresh(t *testing.T) { // Set up a testing helm home - oldhome := helmHome + oldhome := settings.Home hh, err := tempHelmHome(t) if err != nil { t.Fatal(err) } - helmHome = hh + settings.Home = hh defer func() { - os.RemoveAll(hh) - helmHome = oldhome + os.RemoveAll(hh.String()) + settings.Home = oldhome }() - srv := repotest.NewServer(hh) + srv := repotest.NewServer(hh.String()) defer srv.Stop() copied, err := srv.CopyCharts("testdata/testcharts/*.tgz") if err != nil { @@ -151,14 +151,14 @@ func TestDependencyUpdateCmd_SkipRefresh(t *testing.T) { t.Logf("Listening on directory %s", srv.Root()) chartname := "depup" - if err := createTestingChart(hh, chartname, srv.URL()); err != nil { + if err := createTestingChart(hh.String(), chartname, srv.URL()); err != nil { t.Fatal(err) } out := bytes.NewBuffer(nil) duc := &dependencyUpdateCmd{out: out} duc.helmhome = helmpath.Home(hh) - duc.chartpath = filepath.Join(hh, chartname) + duc.chartpath = filepath.Join(hh.String(), chartname) duc.skipRefresh = true if err := duc.run(); err == nil { diff --git a/cmd/helm/fetch.go b/cmd/helm/fetch.go index b7e5d060c65cb2d983348bd0a78c41a43996086a..3dbf645cc7819a9592fef4f702285239304a20bb 100644 --- a/cmd/helm/fetch.go +++ b/cmd/helm/fetch.go @@ -26,7 +26,7 @@ import ( "github.com/spf13/cobra" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/downloader" - "k8s.io/helm/pkg/helm/helmpath" + "k8s.io/helm/pkg/getter/defaultgetters" ) const fetchDesc = ` @@ -93,10 +93,11 @@ func newFetchCmd(out io.Writer) *cobra.Command { func (f *fetchCmd) run() error { c := downloader.ChartDownloader{ - HelmHome: helmpath.Home(homePath()), + HelmHome: settings.Home, Out: f.out, Keyring: f.keyring, Verify: downloader.VerifyNever, + Getters: defaultgetters.Get(settings), } if f.verify { diff --git a/cmd/helm/fetch_test.go b/cmd/helm/fetch_test.go index 9b050af0d5f12ec44ece98a7235e98502a27b7b8..8c1f2a74b00d9018cbee041d30c001e5c179b2fc 100644 --- a/cmd/helm/fetch_test.go +++ b/cmd/helm/fetch_test.go @@ -24,6 +24,8 @@ import ( "regexp" "testing" + "k8s.io/helm/pkg/helm/environment" + "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/repo/repotest" ) @@ -32,11 +34,11 @@ func TestFetchCmd(t *testing.T) { if err != nil { t.Fatal(err) } - old := homePath() - helmHome = hh + old := helmpath.Home(environment.DefaultHelmHome()) + settings.Home = hh defer func() { - helmHome = old - os.RemoveAll(hh) + settings.Home = old + os.RemoveAll(hh.String()) }() // all flags will get "--home=TMDIR -d outdir" appended. @@ -105,7 +107,7 @@ func TestFetchCmd(t *testing.T) { }, } - srv := repotest.NewServer(hh) + srv := repotest.NewServer(hh.String()) defer srv.Stop() if _, err := srv.CopyCharts("testdata/testcharts/*.tgz*"); err != nil { @@ -116,7 +118,7 @@ func TestFetchCmd(t *testing.T) { } for _, tt := range tests { - outdir := filepath.Join(hh, "testout") + outdir := filepath.Join(hh.String(), "testout") os.RemoveAll(outdir) os.Mkdir(outdir, 0755) diff --git a/cmd/helm/get.go b/cmd/helm/get.go index 3d6aecde59ddfc58c1c9353fb5f3a33233149eca..b540d24feddd494037699af94815e201d22be803 100644 --- a/cmd/helm/get.go +++ b/cmd/helm/get.go @@ -64,7 +64,7 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command { } get.release = args[0] if get.client == nil { - get.client = helm.NewClient(helm.Host(tillerHost)) + get.client = helm.NewClient(helm.Host(settings.TillerHost)) } return get.run() }, diff --git a/cmd/helm/get_manifest.go b/cmd/helm/get_manifest.go index 85b31df06f52cf429caef123859fbdfbbd8f1637..190c03f484ed3ff1d40ba383521d30b045127bb0 100644 --- a/cmd/helm/get_manifest.go +++ b/cmd/helm/get_manifest.go @@ -55,7 +55,7 @@ func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command { } get.release = args[0] if get.client == nil { - get.client = helm.NewClient(helm.Host(tillerHost)) + get.client = helm.NewClient(helm.Host(settings.TillerHost)) } return get.run() }, diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index c6bfcdf22f14eaaf0f2040404c9bcf39edcad8d3..113cf6b148383a427f8af3dab45d315683c645fe 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -23,7 +23,6 @@ import ( "io/ioutil" "log" "os" - "path/filepath" "strings" "github.com/spf13/cobra" @@ -33,18 +32,16 @@ import ( "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/helm/pkg/helm" + helm_env "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/portforwarder" "k8s.io/helm/pkg/kube" - "k8s.io/helm/pkg/tiller/environment" + tiller_env "k8s.io/helm/pkg/tiller/environment" "k8s.io/helm/pkg/tlsutil" ) const ( localRepoIndexFilePath = "index.yaml" - homeEnvVar = "HELM_HOME" - hostEnvVar = "HELM_HOST" - tillerNamespaceEnvVar = "TILLER_NAMESPACE" ) var ( @@ -56,17 +53,12 @@ var ( ) var ( - helmHome string - tillerHost string - tillerNamespace string - kubeContext string + kubeContext string + settings helm_env.EnvSettings // TODO refactor out this global var tillerTunnel *kube.Tunnel ) -// flagDebug is a signal that the user wants additional output. -var flagDebug bool - var globalUsage = `The Kubernetes package manager To begin working with Helm, run the 'helm init' command: @@ -92,6 +84,8 @@ Environment: ` func newRootCmd(out io.Writer) *cobra.Command { + var helmHomeTemp string + cmd := &cobra.Command{ Use: "helm", Short: "The Helm package manager for Kubernetes.", @@ -107,11 +101,19 @@ func newRootCmd(out io.Writer) *cobra.Command { }, } p := cmd.PersistentFlags() - p.StringVar(&helmHome, "home", defaultHelmHome(), "location of your Helm config. Overrides $HELM_HOME") - p.StringVar(&tillerHost, "host", defaultHelmHost(), "address of tiller. Overrides $HELM_HOST") + p.StringVar(&helmHomeTemp, "home", helm_env.DefaultHelmHome(), "location of your Helm config. Overrides $HELM_HOME") + settings.Home = helmpath.Home(helmHomeTemp) + p.StringVar(&settings.TillerHost, "host", helm_env.DefaultHelmHost(), "address of tiller. Overrides $HELM_HOST") p.StringVar(&kubeContext, "kube-context", "", "name of the kubeconfig context to use") - p.BoolVar(&flagDebug, "debug", false, "enable verbose output") - p.StringVar(&tillerNamespace, "tiller-namespace", defaultTillerNamespace(), "namespace of tiller") + p.BoolVar(&settings.FlagDebug, "debug", false, "enable verbose output") + p.StringVar(&settings.TillerNamespace, "tiller-namespace", tiller_env.GetTillerNamespace(), "namespace of tiller") + + if os.Getenv(helm_env.PluginDisableEnvVar) != "1" { + settings.PlugDirs = os.Getenv(helm_env.PluginEnvVar) + if settings.PlugDirs == "" { + settings.PlugDirs = settings.Home.Plugins() + } + } cmd.AddCommand( // chart commands @@ -153,7 +155,7 @@ func newRootCmd(out io.Writer) *cobra.Command { ) // Find and add plugins - loadPlugins(cmd, helmpath.Home(homePath()), out) + loadPlugins(cmd, out) return cmd } @@ -176,26 +178,26 @@ func markDeprecated(cmd *cobra.Command, notice string) *cobra.Command { } func setupConnection(c *cobra.Command, args []string) error { - if tillerHost == "" { + if settings.TillerHost == "" { config, client, err := getKubeClient(kubeContext) if err != nil { return err } - tunnel, err := portforwarder.New(tillerNamespace, client, config) + tunnel, err := portforwarder.New(settings.TillerNamespace, client, config) if err != nil { return err } - tillerHost = fmt.Sprintf("localhost:%d", tunnel.Local) - if flagDebug { + settings.TillerHost = fmt.Sprintf("localhost:%d", tunnel.Local) + if settings.FlagDebug { fmt.Printf("Created tunnel using local port: '%d'\n", tunnel.Local) } } // Set up the gRPC config. - if flagDebug { - fmt.Printf("SERVER: %q\n", tillerHost) + if settings.FlagDebug { + fmt.Printf("SERVER: %q\n", settings.TillerHost) } // Plugin support. return nil @@ -230,30 +232,6 @@ func prettyError(err error) error { return errors.New(grpc.ErrorDesc(err)) } -func defaultHelmHome() string { - if home := os.Getenv(homeEnvVar); home != "" { - return home - } - return filepath.Join(os.Getenv("HOME"), ".helm") -} - -func homePath() string { - s := os.ExpandEnv(helmHome) - os.Setenv(homeEnvVar, s) - return s -} - -func defaultHelmHost() string { - return os.Getenv(hostEnvVar) -} - -func defaultTillerNamespace() string { - if ns := os.Getenv(tillerNamespaceEnvVar); ns != "" { - return ns - } - return environment.DefaultTillerNamespace -} - // getKubeClient is a convenience method for creating kubernetes config and client // for a given kubeconfig context func getKubeClient(context string) (*rest.Config, *internalclientset.Clientset, error) { @@ -277,7 +255,7 @@ func ensureHelmClient(h helm.Interface) helm.Interface { } func newClient() helm.Interface { - options := []helm.Option{helm.Host(tillerHost)} + options := []helm.Option{helm.Host(settings.TillerHost)} if tlsVerify || tlsEnable { tlsopts := tlsutil.Options{KeyFile: tlsKeyFile, CertFile: tlsCertFile, InsecureSkipVerify: true} diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index efc4fce397a051060ef708ad8c0f71c3611bac1d..016b79d6b13f702c8cadbf2d10b5c1f1ea52cb17 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -244,19 +244,19 @@ type releaseCase struct { // // This does not clean up the directory. You must do that yourself. // You must also set helmHome yourself. -func tempHelmHome(t *testing.T) (string, error) { - oldhome := helmHome +func tempHelmHome(t *testing.T) (helmpath.Home, error) { + oldhome := settings.Home dir, err := ioutil.TempDir("", "helm_home-") if err != nil { - return "n/", err + return helmpath.Home("n/"), err } - helmHome = dir - if err := ensureTestHome(helmpath.Home(helmHome), t); err != nil { - return "n/", err + settings.Home = helmpath.Home(dir) + if err := ensureTestHome(settings.Home, t); err != nil { + return helmpath.Home("n/"), err } - helmHome = oldhome - return dir, nil + settings.Home = oldhome + return helmpath.Home(dir), nil } // ensureTestHome creates a home directory like ensureHome, but without remote references. @@ -312,6 +312,6 @@ func ensureTestHome(home helmpath.Home, t *testing.T) error { return fmt.Errorf("%s must be a file, not a directory", localRepoIndexFile) } - t.Logf("$HELM_HOME has been configured at %s.\n", helmHome) + t.Logf("$HELM_HOME has been configured at %s.\n", settings.Home.String()) return nil } diff --git a/cmd/helm/history.go b/cmd/helm/history.go index 581f0593586ddb85828cd70f24d964e0f3802bcd..21c444dabf3b08996e59569695324dd044bff46f 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -66,7 +66,7 @@ func newHistoryCmd(c helm.Interface, w io.Writer) *cobra.Command { case len(args) == 0: return errReleaseRequired case his.helmc == nil: - his.helmc = helm.NewClient(helm.Host(tillerHost)) + his.helmc = helm.NewClient(helm.Host(settings.TillerHost)) } his.rls = args[0] return his.run() diff --git a/cmd/helm/home.go b/cmd/helm/home.go index 59e5538df3a53f36d40aff84f9fe97dc64c125a3..6f2647db066c63f5c8fdd795e89d9263b09db187 100644 --- a/cmd/helm/home.go +++ b/cmd/helm/home.go @@ -21,7 +21,6 @@ import ( "io" "github.com/spf13/cobra" - "k8s.io/helm/pkg/helm/helmpath" ) var longHomeHelp = ` @@ -35,9 +34,9 @@ func newHomeCmd(out io.Writer) *cobra.Command { Short: "displays the location of HELM_HOME", Long: longHomeHelp, Run: func(cmd *cobra.Command, args []string) { - h := helmpath.Home(homePath()) + h := settings.Home fmt.Fprintf(out, "%s\n", h) - if flagDebug { + if settings.FlagDebug { fmt.Fprintf(out, "Repository: %s\n", h.Repository()) fmt.Fprintf(out, "RepositoryFile: %s\n", h.RepositoryFile()) fmt.Fprintf(out, "Cache: %s\n", h.Cache()) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index be3d05528b92f1312e69c7fb06e3f46e683bebc7..56fc9941de5caa5072204947b27b17ece5b44324 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -27,6 +27,7 @@ import ( "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/helm/cmd/helm/installer" + "k8s.io/helm/pkg/getter/defaultgetters" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/repo" ) @@ -91,8 +92,8 @@ func newInitCmd(out io.Writer) *cobra.Command { if len(args) != 0 { return errors.New("This command does not accept arguments") } - i.namespace = tillerNamespace - i.home = helmpath.Home(homePath()) + i.namespace = settings.TillerNamespace + i.home = settings.Home return i.run() }, } @@ -152,7 +153,7 @@ func (i *initCmd) run() error { i.opts.UseCanary = i.canary i.opts.ImageSpec = i.image - if flagDebug { + if settings.FlagDebug { writeYAMLManifest := func(apiVersion, kind, body string, first, last bool) error { w := i.out if !first { @@ -221,7 +222,7 @@ func (i *initCmd) run() error { if err := ensureRepoFileFormat(i.home.RepositoryFile(), i.out); err != nil { return err } - fmt.Fprintf(i.out, "$HELM_HOME has been configured at %s.\n", helmHome) + fmt.Fprintf(i.out, "$HELM_HOME has been configured at %s.\n", settings.Home) if !i.clientOnly { if i.kubeClient == nil { @@ -311,7 +312,7 @@ func initStableRepo(cacheFile string, skipRefresh bool) (*repo.Entry, error) { URL: stableRepositoryURL, Cache: cacheFile, } - r, err := repo.NewChartRepository(&c) + r, err := repo.NewChartRepository(&c, defaultgetters.Get(settings)) if err != nil { return nil, err } diff --git a/cmd/helm/init_test.go b/cmd/helm/init_test.go index f6f93fed95725a7b724316afbf2b7271ee4c1444..aede2c7508ff6ee80b4b9924c9b1837b0d89b87e 100644 --- a/cmd/helm/init_test.go +++ b/cmd/helm/init_test.go @@ -137,11 +137,11 @@ func TestInitCmd_dryRun(t *testing.T) { if err != nil { t.Fatal(err) } - dbg := flagDebug - flagDebug = true + dbg := settings.FlagDebug + settings.FlagDebug = true defer func() { os.Remove(home) - flagDebug = dbg + settings.FlagDebug = dbg }() var buf bytes.Buffer @@ -182,7 +182,7 @@ func TestEnsureHome(t *testing.T) { b := bytes.NewBuffer(nil) hh := helmpath.Home(home) - helmHome = home + settings.Home = hh if err := ensureDirectories(hh, b); err != nil { t.Error(err) } diff --git a/cmd/helm/install.go b/cmd/helm/install.go index d738b43497fd038d379aa1ea4662ed40189af321..d119802f8dc2e9398c0a600d965bf3135024bd86 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -34,8 +34,8 @@ import ( "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/downloader" + "k8s.io/helm/pkg/getter/defaultgetters" "k8s.io/helm/pkg/helm" - "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" @@ -178,7 +178,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { } func (i *installCmd) run() error { - if flagDebug { + if settings.FlagDebug { fmt.Fprintf(i.out, "CHART PATH: %s\n", i.chartPath) } @@ -312,7 +312,7 @@ func (i *installCmd) printRelease(rel *release.Release) { } // TODO: Switch to text/template like everything else. fmt.Fprintf(i.out, "NAME: %s\n", rel.Name) - if flagDebug { + if settings.FlagDebug { printRelease(i.out, rel) } } @@ -350,15 +350,16 @@ func locateChartPath(name, version string, verify bool, keyring string) (string, return name, fmt.Errorf("path %q not found", name) } - crepo := filepath.Join(helmpath.Home(homePath()).Repository(), name) + crepo := filepath.Join(settings.Home.Repository(), name) if _, err := os.Stat(crepo); err == nil { return filepath.Abs(crepo) } dl := downloader.ChartDownloader{ - HelmHome: helmpath.Home(homePath()), + HelmHome: settings.Home, Out: os.Stdout, Keyring: keyring, + Getters: defaultgetters.Get(settings), } if verify { dl.Verify = downloader.VerifyAlways @@ -370,11 +371,11 @@ func locateChartPath(name, version string, verify bool, keyring string) (string, if err != nil { return filename, err } - if flagDebug { + if settings.FlagDebug { fmt.Printf("Fetched %s to %s\n", name, filename) } return lname, nil - } else if flagDebug { + } else if settings.FlagDebug { return filename, err } diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 3764f365ea280f52ccc55cd07f653e7c61049de9..0919a1c3bb152bc7dcac9b9ad812a20268debe21 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -92,7 +92,7 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { list.filter = strings.Join(args, " ") } if list.client == nil { - list.client = helm.NewClient(helm.Host(tillerHost)) + list.client = helm.NewClient(helm.Host(settings.TillerHost)) } return list.run() }, diff --git a/cmd/helm/load_plugins.go b/cmd/helm/load_plugins.go index f33161b31bc6a6727a7756433373aa59715547e9..af4e2f2bfe43b15e0f19fb1cd4214bdb44273d15 100644 --- a/cmd/helm/load_plugins.go +++ b/cmd/helm/load_plugins.go @@ -43,15 +43,14 @@ func pluginDirs(home helmpath.Home) string { // This follows a different pattern than the other commands because it has // to inspect its environment and then add commands to the base command // as it finds them. -func loadPlugins(baseCmd *cobra.Command, home helmpath.Home, out io.Writer) { +func loadPlugins(baseCmd *cobra.Command, out io.Writer) { // If HELM_NO_PLUGINS is set to 1, do not load plugins. - if os.Getenv("HELM_NO_PLUGINS") == "1" { + if settings.PlugDirs == "" { return } - plugdirs := pluginDirs(home) - found, err := findPlugins(plugdirs) + found, err := findPlugins(settings.PlugDirs) if err != nil { fmt.Fprintf(os.Stderr, "failed to load plugins: %s", err) return @@ -79,7 +78,7 @@ func loadPlugins(baseCmd *cobra.Command, home helmpath.Home, out io.Writer) { // Call setupEnv before PrepareCommand because // PrepareCommand uses os.ExpandEnv and expects the // setupEnv vars. - setupEnv(md.Name, plug.Dir, plugdirs, home) + plugin.SetupPluginEnv(settings, md.Name, plug.Dir) main, argv := plug.PrepareCommand(u) prog := exec.Command(main, argv...) @@ -161,36 +160,3 @@ func findPlugins(plugdirs string) ([]*plugin.Plugin, error) { } return found, nil } - -// setupEnv prepares os.Env for plugins. It operates on os.Env because -// the plugin subsystem itself needs access to the environment variables -// created here. -func setupEnv(shortname, base, plugdirs string, home helmpath.Home) { - // Set extra env vars: - for key, val := range map[string]string{ - "HELM_PLUGIN_NAME": shortname, - "HELM_PLUGIN_DIR": base, - "HELM_BIN": os.Args[0], - - // Set vars that may not have been set, and save client the - // trouble of re-parsing. - pluginEnvVar: plugdirs, - homeEnvVar: home.String(), - - // Set vars that convey common information. - "HELM_PATH_REPOSITORY": home.Repository(), - "HELM_PATH_REPOSITORY_FILE": home.RepositoryFile(), - "HELM_PATH_CACHE": home.Cache(), - "HELM_PATH_LOCAL_REPOSITORY": home.LocalRepository(), - "HELM_PATH_STARTER": home.Starters(), - - "TILLER_HOST": tillerHost, - tillerNamespaceEnvVar: tillerNamespace, - } { - os.Setenv(key, val) - } - - if flagDebug { - os.Setenv("HELM_DEBUG", "1") - } -} diff --git a/cmd/helm/package.go b/cmd/helm/package.go index 100a4663de3beaf14d58131f132d0ee3d35f4586..89ec2b18ed8c88537fa04081246e2ee0ede80b71 100644 --- a/cmd/helm/package.go +++ b/cmd/helm/package.go @@ -70,7 +70,7 @@ func newPackageCmd(out io.Writer) *cobra.Command { Short: "package a chart directory into a chart archive", Long: packageDesc, RunE: func(cmd *cobra.Command, args []string) error { - pkg.home = helmpath.Home(homePath()) + pkg.home = settings.Home if len(args) == 0 { return fmt.Errorf("This command needs at least one argument, the path to the chart.") } @@ -119,7 +119,7 @@ func (p *packageCmd) run(cmd *cobra.Command, args []string) error { if err := setVersion(ch, p.version); err != nil { return err } - if flagDebug { + if settings.FlagDebug { fmt.Fprintf(p.out, "Setting version to %s", p.version) } } @@ -145,7 +145,7 @@ func (p *packageCmd) run(cmd *cobra.Command, args []string) error { } name, err := chartutil.Save(ch, dest) - if err == nil && flagDebug { + if err == nil && settings.FlagDebug { fmt.Fprintf(p.out, "Saved %s to current directory\n", name) } @@ -155,7 +155,7 @@ func (p *packageCmd) run(cmd *cobra.Command, args []string) error { lr := p.home.LocalRepository() if err := repo.AddChartToLocalRepo(ch, lr); err != nil { return err - } else if flagDebug { + } else if settings.FlagDebug { fmt.Fprintf(p.out, "Saved %s to %s\n", name, lr) } } @@ -194,7 +194,7 @@ func (p *packageCmd) clearsign(filename string) error { return err } - if flagDebug { + if settings.FlagDebug { fmt.Fprintln(p.out, sig) } diff --git a/cmd/helm/package_test.go b/cmd/helm/package_test.go index 340da0fdb56260a6507360d03be725060b6481f2..1d25260d4598c781695c73cebbd6695c661db856 100644 --- a/cmd/helm/package_test.go +++ b/cmd/helm/package_test.go @@ -143,10 +143,10 @@ func TestPackage(t *testing.T) { } ensureTestHome(helmpath.Home(tmp), t) - oldhome := homePath() - helmHome = tmp + oldhome := settings.Home + settings.Home = helmpath.Home(tmp) defer func() { - helmHome = oldhome + settings.Home = oldhome os.Chdir(origDir) os.RemoveAll(tmp) }() diff --git a/cmd/helm/plugin.go b/cmd/helm/plugin.go index 58290eec3b94295b76074a248f307b3c7677e07f..37d9205b789a741be918a804e004ceab2c0a5568 100644 --- a/cmd/helm/plugin.go +++ b/cmd/helm/plugin.go @@ -59,7 +59,7 @@ func runHook(p *plugin.Plugin, event string, home helmpath.Home) error { debug("running %s hook: %s", event, prog) - setupEnv(p.Metadata.Name, p.Dir, home.Plugins(), home) + plugin.SetupPluginEnv(settings, p.Metadata.Name, p.Dir) prog.Stdout, prog.Stderr = os.Stdout, os.Stderr if err := prog.Run(); err != nil { if eerr, ok := err.(*exec.ExitError); ok { diff --git a/cmd/helm/plugin_install.go b/cmd/helm/plugin_install.go index befa1d8fda656c416e3ad48c7476cbd93fa1ce2e..e56c3b2299ce9538c0c07e4b347361b9b7e196c6 100644 --- a/cmd/helm/plugin_install.go +++ b/cmd/helm/plugin_install.go @@ -54,12 +54,12 @@ func (pcmd *pluginInstallCmd) complete(args []string) error { return err } pcmd.source = args[0] - pcmd.home = helmpath.Home(homePath()) + pcmd.home = settings.Home return nil } func (pcmd *pluginInstallCmd) run() error { - installer.Debug = flagDebug + installer.Debug = settings.FlagDebug i, err := installer.NewForSource(pcmd.source, pcmd.version, pcmd.home) if err != nil { diff --git a/cmd/helm/plugin_list.go b/cmd/helm/plugin_list.go index e71b720387119f4349d24d405aa7150db8de1642..0bf9acbc89a2487e39aea97a2c9a7bd1bc075ca4 100644 --- a/cmd/helm/plugin_list.go +++ b/cmd/helm/plugin_list.go @@ -36,7 +36,7 @@ func newPluginListCmd(out io.Writer) *cobra.Command { Use: "list", Short: "list installed Helm plugins", RunE: func(cmd *cobra.Command, args []string) error { - pcmd.home = helmpath.Home(homePath()) + pcmd.home = settings.Home return pcmd.run() }, } diff --git a/cmd/helm/plugin_remove.go b/cmd/helm/plugin_remove.go index 74fc680b71132f12c25523721ad1073b346b10ff..da2041f8962d1dc3524a742ac1b110fd758a9155 100644 --- a/cmd/helm/plugin_remove.go +++ b/cmd/helm/plugin_remove.go @@ -52,7 +52,7 @@ func (pcmd *pluginRemoveCmd) complete(args []string) error { return err } pcmd.names = args - pcmd.home = helmpath.Home(homePath()) + pcmd.home = settings.Home return nil } diff --git a/cmd/helm/plugin_test.go b/cmd/helm/plugin_test.go index d1cb868ba065ce6fbbe44075f257c1cb8be81cec..cd0e3da74395be73b48c402d85badba1bc4b6c8c 100644 --- a/cmd/helm/plugin_test.go +++ b/cmd/helm/plugin_test.go @@ -24,6 +24,7 @@ import ( "testing" "k8s.io/helm/pkg/helm/helmpath" + "k8s.io/helm/pkg/plugin" "github.com/spf13/cobra" ) @@ -64,16 +65,17 @@ func TestManuallyProcessArgs(t *testing.T) { func TestLoadPlugins(t *testing.T) { // Set helm home to point to testdata - old := helmHome - helmHome = "testdata/helmhome" + old := settings.Home + settings.Home = "testdata/helmhome" defer func() { - helmHome = old + settings.Home = old }() - hh := helmpath.Home(homePath()) + hh := settings.Home + settings.PlugDirs = hh.Plugins() out := bytes.NewBuffer(nil) cmd := &cobra.Command{} - loadPlugins(cmd, hh, out) + loadPlugins(cmd, out) envs := strings.Join([]string{ "fullenv", @@ -135,20 +137,19 @@ func TestLoadPlugins(t *testing.T) { } func TestLoadPlugins_HelmNoPlugins(t *testing.T) { - os.Setenv("HELM_NO_PLUGINS", "1") - defer os.Setenv("HELM_NO_PLUGINS", "0") - // Set helm home to point to testdata - old := helmHome - helmHome = "testdata/helmhome" + old := settings.Home + oldPlugDirs := settings.PlugDirs + settings.Home = "testdata/helmhome" + settings.PlugDirs = "" defer func() { - helmHome = old + settings.Home = old + settings.PlugDirs = oldPlugDirs }() - hh := helmpath.Home(homePath()) out := bytes.NewBuffer(nil) cmd := &cobra.Command{} - loadPlugins(cmd, hh, out) + loadPlugins(cmd, out) plugins := cmd.Commands() if len(plugins) != 0 { @@ -158,31 +159,31 @@ func TestLoadPlugins_HelmNoPlugins(t *testing.T) { func TestSetupEnv(t *testing.T) { name := "pequod" - hh := helmpath.Home("testdata/helmhome") - base := filepath.Join(hh.Plugins(), name) - plugdirs := hh.Plugins() - flagDebug = true + settings.Home = helmpath.Home("testdata/helmhome") + base := filepath.Join(settings.Home.Plugins(), name) + settings.PlugDirs = settings.Home.Plugins() + settings.FlagDebug = true defer func() { - flagDebug = false + settings.FlagDebug = false }() - setupEnv(name, base, plugdirs, hh) + plugin.SetupPluginEnv(settings, name, base) for _, tt := range []struct { name string expect string }{ {"HELM_PLUGIN_NAME", name}, {"HELM_PLUGIN_DIR", base}, - {"HELM_PLUGIN", hh.Plugins()}, + {"HELM_PLUGIN", settings.Home.Plugins()}, {"HELM_DEBUG", "1"}, - {"HELM_HOME", hh.String()}, - {"HELM_PATH_REPOSITORY", hh.Repository()}, - {"HELM_PATH_REPOSITORY_FILE", hh.RepositoryFile()}, - {"HELM_PATH_CACHE", hh.Cache()}, - {"HELM_PATH_LOCAL_REPOSITORY", hh.LocalRepository()}, - {"HELM_PATH_STARTER", hh.Starters()}, - {"TILLER_HOST", tillerHost}, - {"TILLER_NAMESPACE", tillerNamespace}, + {"HELM_HOME", settings.Home.String()}, + {"HELM_PATH_REPOSITORY", settings.Home.Repository()}, + {"HELM_PATH_REPOSITORY_FILE", settings.Home.RepositoryFile()}, + {"HELM_PATH_CACHE", settings.Home.Cache()}, + {"HELM_PATH_LOCAL_REPOSITORY", settings.Home.LocalRepository()}, + {"HELM_PATH_STARTER", settings.Home.Starters()}, + {"TILLER_HOST", settings.TillerHost}, + {"TILLER_NAMESPACE", settings.TillerNamespace}, } { if got := os.Getenv(tt.name); got != tt.expect { t.Errorf("Expected $%s=%q, got %q", tt.name, tt.expect, got) diff --git a/cmd/helm/printer.go b/cmd/helm/printer.go index dbffd5c44a334c16484a01b0d05fa9e963b02edf..a8b04dfda3e17073940924c4aff399f2a334f303 100644 --- a/cmd/helm/printer.go +++ b/cmd/helm/printer.go @@ -75,7 +75,7 @@ func tpl(t string, vals map[string]interface{}, out io.Writer) error { } func debug(format string, args ...interface{}) { - if flagDebug { + if settings.FlagDebug { format = fmt.Sprintf("[debug] %s\n", format) fmt.Printf(format, args...) } diff --git a/cmd/helm/repo_add.go b/cmd/helm/repo_add.go index 523ac5ad1e0f3637f8b15f95cb1f83788bccecf9..92bf61107edbe9149066b238ce831166c34586e6 100644 --- a/cmd/helm/repo_add.go +++ b/cmd/helm/repo_add.go @@ -22,6 +22,7 @@ import ( "github.com/spf13/cobra" + "k8s.io/helm/pkg/getter/defaultgetters" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/repo" ) @@ -54,7 +55,7 @@ func newRepoAddCmd(out io.Writer) *cobra.Command { add.name = args[0] add.url = args[1] - add.home = helmpath.Home(homePath()) + add.home = settings.Home return add.run() }, @@ -97,7 +98,7 @@ func addRepository(name, url string, home helmpath.Home, certFile, keyFile, caFi CAFile: caFile, } - r, err := repo.NewChartRepository(&c) + r, err := repo.NewChartRepository(&c, defaultgetters.Get(settings)) if err != nil { return err } diff --git a/cmd/helm/repo_add_test.go b/cmd/helm/repo_add_test.go index 9ca4dc5d4a62c16f6c9ce76afca67981bed3f323..005826deafaeaf75921f3ea838d13d6c8e01c4c7 100644 --- a/cmd/helm/repo_add_test.go +++ b/cmd/helm/repo_add_test.go @@ -21,7 +21,6 @@ import ( "os" "testing" - "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/repo/repotest" ) @@ -34,14 +33,14 @@ func TestRepoAddCmd(t *testing.T) { t.Fatal(err) } - oldhome := homePath() - helmHome = thome + oldhome := settings.Home + settings.Home = thome defer func() { srv.Stop() - helmHome = oldhome - os.Remove(thome) + settings.Home = oldhome + os.Remove(thome.String()) }() - if err := ensureTestHome(helmpath.Home(thome), t); err != nil { + if err := ensureTestHome(thome, t); err != nil { t.Fatal(err) } @@ -68,13 +67,13 @@ func TestRepoAdd(t *testing.T) { t.Fatal(err) } - oldhome := homePath() - helmHome = thome - hh := helmpath.Home(thome) + oldhome := settings.Home + settings.Home = thome + hh := thome defer func() { ts.Stop() - helmHome = oldhome - os.Remove(thome) + settings.Home = oldhome + os.Remove(thome.String()) }() if err := ensureTestHome(hh, t); err != nil { t.Fatal(err) diff --git a/cmd/helm/repo_list.go b/cmd/helm/repo_list.go index 0fd471bb49092060c2f5915dea2c9d9a1cb5f6dc..f4a1af948316a074eea0db261fe7894d2e731fe8 100644 --- a/cmd/helm/repo_list.go +++ b/cmd/helm/repo_list.go @@ -42,7 +42,7 @@ func newRepoListCmd(out io.Writer) *cobra.Command { Use: "list [flags]", Short: "list chart repositories", RunE: func(cmd *cobra.Command, args []string) error { - list.home = helmpath.Home(homePath()) + list.home = settings.Home return list.run() }, } diff --git a/cmd/helm/repo_remove.go b/cmd/helm/repo_remove.go index 5b82bdc0a28caf57191af17b6682626b17fc8451..b72930b551002386dd0faf7eeb26291acefb2809 100644 --- a/cmd/helm/repo_remove.go +++ b/cmd/helm/repo_remove.go @@ -47,7 +47,7 @@ func newRepoRemoveCmd(out io.Writer) *cobra.Command { return err } remove.name = args[0] - remove.home = helmpath.Home(homePath()) + remove.home = settings.Home return remove.run() }, diff --git a/cmd/helm/repo_remove_test.go b/cmd/helm/repo_remove_test.go index 3fb20a8211eda49f24e2148961574f5f95b254a2..a0c5a1f5a52014cc42af6d3d86a7ae25221cfa7d 100644 --- a/cmd/helm/repo_remove_test.go +++ b/cmd/helm/repo_remove_test.go @@ -33,13 +33,13 @@ func TestRepoRemove(t *testing.T) { t.Fatal(err) } - oldhome := homePath() - helmHome = thome + oldhome := settings.Home + settings.Home = thome hh := helmpath.Home(thome) defer func() { ts.Stop() - helmHome = oldhome - os.Remove(thome) + settings.Home = oldhome + os.Remove(thome.String()) }() if err := ensureTestHome(hh, t); err != nil { t.Fatal(err) diff --git a/cmd/helm/repo_update.go b/cmd/helm/repo_update.go index 881a1b7cab29dfd72c99fb2464f5d63c89cdbcd9..d45633497da4fb5d74b2bc3d3b1e415df31db693 100644 --- a/cmd/helm/repo_update.go +++ b/cmd/helm/repo_update.go @@ -24,6 +24,7 @@ import ( "github.com/spf13/cobra" + "k8s.io/helm/pkg/getter/defaultgetters" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/repo" ) @@ -57,7 +58,7 @@ func newRepoUpdateCmd(out io.Writer) *cobra.Command { Short: "update information on available charts in the chart repositories", Long: updateDesc, RunE: func(cmd *cobra.Command, args []string) error { - u.home = helmpath.Home(homePath()) + u.home = settings.Home return u.run() }, } @@ -75,7 +76,7 @@ func (u *repoUpdateCmd) run() error { } var repos []*repo.ChartRepository for _, cfg := range f.Repositories { - r, err := repo.NewChartRepository(cfg) + r, err := repo.NewChartRepository(cfg, defaultgetters.Get(settings)) if err != nil { return err } diff --git a/cmd/helm/repo_update_test.go b/cmd/helm/repo_update_test.go index 447a16a6ff93c786c71a3fb4128ca04ee6cf39b4..ecd23543d06008e38538264b30cccdf108c0cbe3 100644 --- a/cmd/helm/repo_update_test.go +++ b/cmd/helm/repo_update_test.go @@ -23,6 +23,7 @@ import ( "strings" "testing" + "k8s.io/helm/pkg/getter/defaultgetters" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/repo/repotest" @@ -33,11 +34,11 @@ func TestUpdateCmd(t *testing.T) { if err != nil { t.Fatal(err) } - oldhome := homePath() - helmHome = thome + oldhome := settings.Home + settings.Home = thome defer func() { - helmHome = oldhome - os.Remove(thome) + settings.Home = oldhome + os.Remove(thome.String()) }() out := bytes.NewBuffer(nil) @@ -68,13 +69,13 @@ func TestUpdateCharts(t *testing.T) { t.Fatal(err) } - oldhome := homePath() - helmHome = thome + oldhome := settings.Home + settings.Home = thome hh := helmpath.Home(thome) defer func() { ts.Stop() - helmHome = oldhome - os.Remove(thome) + settings.Home = oldhome + os.Remove(thome.String()) }() if err := ensureTestHome(hh, t); err != nil { t.Fatal(err) @@ -84,7 +85,7 @@ func TestUpdateCharts(t *testing.T) { Name: "charts", URL: ts.URL(), Cache: hh.CacheIndex("charts"), - }) + }, defaultgetters.Get(settings)) if err != nil { t.Error(err) } diff --git a/cmd/helm/reset.go b/cmd/helm/reset.go index 78015f7e0d00646a6cc450f9f4c9bf6d4be14746..c37e3d6874afbeb3a846ab77d26e4481ab7bf1b5 100644 --- a/cmd/helm/reset.go +++ b/cmd/helm/reset.go @@ -63,8 +63,8 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command { return errors.New("This command does not accept arguments") } - d.namespace = tillerNamespace - d.home = helmpath.Home(homePath()) + d.namespace = settings.TillerNamespace + d.home = settings.Home d.client = ensureHelmClient(d.client) return d.run() diff --git a/cmd/helm/search.go b/cmd/helm/search.go index d7fb2482f6fc2e63980263edf43bdb91e11b1a53..a6ad7bbe480687ffaa06cfb59e7b50a8575188f3 100644 --- a/cmd/helm/search.go +++ b/cmd/helm/search.go @@ -48,7 +48,7 @@ type searchCmd struct { } func newSearchCmd(out io.Writer) *cobra.Command { - sc := &searchCmd{out: out, helmhome: helmpath.Home(homePath())} + sc := &searchCmd{out: out, helmhome: settings.Home} cmd := &cobra.Command{ Use: "search [keyword]", diff --git a/cmd/helm/search_test.go b/cmd/helm/search_test.go index f5348006079cfb3e1cb1f6bd9e23edd6a080eb1f..b878ef4c4dff172e4b88d8cc76fbf8a440c97657 100644 --- a/cmd/helm/search_test.go +++ b/cmd/helm/search_test.go @@ -68,9 +68,9 @@ func TestSearchCmd(t *testing.T) { }, } - oldhome := helmHome - helmHome = "testdata/helmhome" - defer func() { helmHome = oldhome }() + oldhome := settings.Home + settings.Home = "testdata/helmhome" + defer func() { settings.Home = oldhome }() for _, tt := range tests { buf := bytes.NewBuffer(nil) diff --git a/cmd/helm/serve.go b/cmd/helm/serve.go index fd3e3eb8fe30496e7df80062d45b0659374fff20..028af9751d5a06edaecf9162dffb19b00af581f5 100644 --- a/cmd/helm/serve.go +++ b/cmd/helm/serve.go @@ -24,7 +24,6 @@ import ( "github.com/spf13/cobra" - "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/repo" ) @@ -62,7 +61,7 @@ func newServeCmd(out io.Writer) *cobra.Command { } f := cmd.Flags() - f.StringVar(&srv.repoPath, "repo-path", helmpath.Home(homePath()).LocalRepository(), "local directory path from which to serve charts") + f.StringVar(&srv.repoPath, "repo-path", settings.Home.LocalRepository(), "local directory path from which to serve charts") f.StringVar(&srv.address, "address", "127.0.0.1:8879", "address to listen on") f.StringVar(&srv.url, "url", "", "external URL of chart repository") diff --git a/cmd/helm/status.go b/cmd/helm/status.go index 9f158e408f2d1434be76036cb9484854b5c12bc8..b635e618608ea8560e47f259293432b9c1e00ca9 100644 --- a/cmd/helm/status.go +++ b/cmd/helm/status.go @@ -67,7 +67,7 @@ func newStatusCmd(client helm.Interface, out io.Writer) *cobra.Command { } status.release = args[0] if status.client == nil { - status.client = helm.NewClient(helm.Host(tillerHost)) + status.client = helm.NewClient(helm.Host(settings.TillerHost)) } return status.run() }, diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 05dc2cccdbf18034791044c2432e307565c284f9..bc4dc2971d4288fb67743146cd7a1efb2bd65993 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -185,7 +185,7 @@ func (u *upgradeCmd) run() error { return fmt.Errorf("UPGRADE FAILED: %v", prettyError(err)) } - if flagDebug { + if settings.FlagDebug { printRelease(u.out, resp.Release) } diff --git a/cmd/helm/version.go b/cmd/helm/version.go index 4a93d58cd74a6b53571f0d4f1aea25eb2433d9e2..bba79a8c11a28fc30498abeb07c35ae78898a148 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -105,7 +105,7 @@ func (v *versionCmd) run() error { if grpc.Code(err) == codes.Unimplemented { return errors.New("server is too old to know its version") } - if flagDebug { + if settings.FlagDebug { fmt.Fprintln(os.Stderr, err) } return errors.New("cannot connect to Tiller") diff --git a/cmd/helm/version_test.go b/cmd/helm/version_test.go index 5f204b789c95d7d8ab805efe8e0faaae2a556320..d22373b68da4723e7e8ad51647ffc49cdd26cd38 100644 --- a/cmd/helm/version_test.go +++ b/cmd/helm/version_test.go @@ -39,7 +39,7 @@ func TestVersion(t *testing.T) { {"server", false, true, []string{"-s"}, false}, } - tillerHost = "fake-localhost" + settings.TillerHost = "fake-localhost" for _, tt := range tests { b := new(bytes.Buffer) c := &fakeReleaseClient{} diff --git a/docs/helm/helm.md b/docs/helm/helm.md index a17a59760fe04012e60f39ecffdbb3cfa583f9ea..3b63cc5f2584a9155f41c21188f924d6e6b07da7 100644 --- a/docs/helm/helm.md +++ b/docs/helm/helm.md @@ -66,4 +66,4 @@ Environment: * [helm verify](helm_verify.md) - verify that a chart at the given path has been signed and is valid * [helm version](helm_version.md) - print the client/server version information -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_completion.md b/docs/helm/helm_completion.md index c2622640ec36e1e7c7ad33ee6a617109ae91dbb5..0e05b6700f157a97d3ed5004345d9579c5fcdf28 100644 --- a/docs/helm/helm_completion.md +++ b/docs/helm/helm_completion.md @@ -34,4 +34,4 @@ helm completion ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_create.md b/docs/helm/helm_create.md index 925e5c824df77bdc9250add8fd2836e4cb6bf932..442becc8707c129d539d45a4b329051cd5c8eb5b 100644 --- a/docs/helm/helm_create.md +++ b/docs/helm/helm_create.md @@ -53,4 +53,4 @@ helm create NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_delete.md b/docs/helm/helm_delete.md index 52fff4fa1022877241c5464844315121848a7885..97620edaaf190e6c70d22bb5c7a12f93dee80575 100644 --- a/docs/helm/helm_delete.md +++ b/docs/helm/helm_delete.md @@ -44,4 +44,4 @@ helm delete [flags] RELEASE_NAME [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_dependency.md b/docs/helm/helm_dependency.md index 1156705da6f2d19b9fed03b181bbbb146ea4e649..69417bc249416e6e16e03df5de4da0e4267e2754 100644 --- a/docs/helm/helm_dependency.md +++ b/docs/helm/helm_dependency.md @@ -70,4 +70,4 @@ for this case. * [helm dependency list](helm_dependency_list.md) - list the dependencies for the given chart * [helm dependency update](helm_dependency_update.md) - update charts/ based on the contents of requirements.yaml -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_dependency_build.md b/docs/helm/helm_dependency_build.md index dc8290b3af66de5aed6e189253e0a194f249a34a..4cd1494441c688903639f5de34f7a8c6f79ba592 100644 --- a/docs/helm/helm_dependency_build.md +++ b/docs/helm/helm_dependency_build.md @@ -40,4 +40,4 @@ helm dependency build [flags] CHART ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_dependency_list.md b/docs/helm/helm_dependency_list.md index f3731607fb14aef7c77ffc851f08e1a7626d66a9..e0223c07eb9fcb4ec23841599f76efac777c49e3 100644 --- a/docs/helm/helm_dependency_list.md +++ b/docs/helm/helm_dependency_list.md @@ -32,4 +32,4 @@ helm dependency list [flags] CHART ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_dependency_update.md b/docs/helm/helm_dependency_update.md index a2760ab0a1948e59c5d91419587b47ae4d933336..553d1f8312e8f256aa81be8b8e2a690b52df0b46 100644 --- a/docs/helm/helm_dependency_update.md +++ b/docs/helm/helm_dependency_update.md @@ -45,4 +45,4 @@ helm dependency update [flags] CHART ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_fetch.md b/docs/helm/helm_fetch.md index 214f9837e99dd4dd2d9d0e7972664695e0557814..904e0577ed8b89857d7260eebee4699313c93ffa 100644 --- a/docs/helm/helm_fetch.md +++ b/docs/helm/helm_fetch.md @@ -49,4 +49,4 @@ helm fetch [flags] [chart URL | repo/chartname] [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_get.md b/docs/helm/helm_get.md index fc334ed7dee9885e0c04222b668fc940f4f2d808..d67af83889622930487323b947fed8e57d6c81cc 100644 --- a/docs/helm/helm_get.md +++ b/docs/helm/helm_get.md @@ -49,4 +49,4 @@ helm get [flags] RELEASE_NAME * [helm get manifest](helm_get_manifest.md) - download the manifest for a named release * [helm get values](helm_get_values.md) - download the values file for a named release -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_get_hooks.md b/docs/helm/helm_get_hooks.md index 2e7e80d6a4d918bd16762997aa1b230e8748ccf2..9e4cbbaca0ccde98bb52ee9793ba5571f4462faf 100644 --- a/docs/helm/helm_get_hooks.md +++ b/docs/helm/helm_get_hooks.md @@ -34,4 +34,4 @@ helm get hooks [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_get_manifest.md b/docs/helm/helm_get_manifest.md index 28fdbe6c8cdfd4cda451b50ec8ba11a727c350de..aa68c4de850a166fcae2c41e395b6cbdef36d9db 100644 --- a/docs/helm/helm_get_manifest.md +++ b/docs/helm/helm_get_manifest.md @@ -36,4 +36,4 @@ helm get manifest [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_get_values.md b/docs/helm/helm_get_values.md index decf1a18da06d94609b294b0f5a77c0130c5bbc2..67568c6a8fd1c134b4e36a339cc13b6d34592430 100644 --- a/docs/helm/helm_get_values.md +++ b/docs/helm/helm_get_values.md @@ -33,4 +33,4 @@ helm get values [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_history.md b/docs/helm/helm_history.md index d6df08b83708b0795015a5d525477be68e71a2f0..1852c66163488fcbee54a5f13149d8db10587430 100644 --- a/docs/helm/helm_history.md +++ b/docs/helm/helm_history.md @@ -49,4 +49,4 @@ helm history [flags] RELEASE_NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_home.md b/docs/helm/helm_home.md index 51a0103c76071323afdc6f7591f9fc650b1a67a0..d86f3ce806f0844165d2b629ac7821a9d423f8d3 100644 --- a/docs/helm/helm_home.md +++ b/docs/helm/helm_home.md @@ -27,4 +27,4 @@ helm home ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_init.md b/docs/helm/helm_init.md index c4cec01835bf79a2c7d7bb3e5fca60bb7f228255..950acf679314a67256791c5385dd98a244e88fc3 100644 --- a/docs/helm/helm_init.md +++ b/docs/helm/helm_init.md @@ -61,4 +61,4 @@ helm init ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 13-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_inspect.md b/docs/helm/helm_inspect.md index fe34a5609a178b8281c7801c2f97ba04568b0a29..df8b5eb2dfada75e7fbb8b2beda19d7af463f0e7 100644 --- a/docs/helm/helm_inspect.md +++ b/docs/helm/helm_inspect.md @@ -39,4 +39,4 @@ helm inspect [CHART] * [helm inspect chart](helm_inspect_chart.md) - shows inspect chart * [helm inspect values](helm_inspect_values.md) - shows inspect values -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_inspect_chart.md b/docs/helm/helm_inspect_chart.md index af5ebef78ac519dad2af0bd3b3ae24aa17711da9..9980b5a46982e569887d1befbec6d8060da9a767 100644 --- a/docs/helm/helm_inspect_chart.md +++ b/docs/helm/helm_inspect_chart.md @@ -35,4 +35,4 @@ helm inspect chart [CHART] ### SEE ALSO * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_inspect_values.md b/docs/helm/helm_inspect_values.md index bfcb108373a9764c0c1eab64893d8d8ade791157..650a64358548c1030f627667a2f7c4ea10ad21f6 100644 --- a/docs/helm/helm_inspect_values.md +++ b/docs/helm/helm_inspect_values.md @@ -35,4 +35,4 @@ helm inspect values [CHART] ### SEE ALSO * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 7ae886aa85cb04438a86aec2dcda9345c5ace380..0f5736887b8ffcfc21be831f1a113c49be8bf617 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -101,4 +101,4 @@ helm install [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_lint.md b/docs/helm/helm_lint.md index 8786dddbaaf244ccf3ec8cafcf08e2ff5a3bdb9f..00f287569bba0c303b19dd29979cc337c1110112 100644 --- a/docs/helm/helm_lint.md +++ b/docs/helm/helm_lint.md @@ -37,4 +37,4 @@ helm lint [flags] PATH ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_list.md b/docs/helm/helm_list.md index 622c0700a4b377dddcad262c1af3c198737d9892..26e4ffcd1b60956ad937c76f9b806a2834b8ff11 100644 --- a/docs/helm/helm_list.md +++ b/docs/helm/helm_list.md @@ -70,4 +70,4 @@ helm list [flags] [FILTER] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_package.md b/docs/helm/helm_package.md index 9b524c6d5cf66e4c19c2c52802fadeda0960efe3..d7afd118b4abbb593471e00a7bbbbe8a081977bc 100644 --- a/docs/helm/helm_package.md +++ b/docs/helm/helm_package.md @@ -44,4 +44,4 @@ helm package [flags] [CHART_PATH] [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_plugin.md b/docs/helm/helm_plugin.md index d224a9f7e0740b28899974504c92da67f8e23cd1..96d474dea5098a6e6fb6814a631452925e76ae6d 100644 --- a/docs/helm/helm_plugin.md +++ b/docs/helm/helm_plugin.md @@ -25,4 +25,4 @@ Manage client-side Helm plugins. * [helm plugin list](helm_plugin_list.md) - list installed Helm plugins * [helm plugin remove](helm_plugin_remove.md) - remove one or more Helm plugins -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_plugin_install.md b/docs/helm/helm_plugin_install.md index c81f1f8e5feed0cd39cd75e4e75a3df7a5fd418f..8480eb2ed487904acb57b7dded44893b26015c53 100644 --- a/docs/helm/helm_plugin_install.md +++ b/docs/helm/helm_plugin_install.md @@ -30,4 +30,4 @@ helm plugin install [options] <path|url>... ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_plugin_list.md b/docs/helm/helm_plugin_list.md index 4cb02287064ac1399d78efd3b108a81f17a4b177..cfa321706ee1b7528cc27dd1c3a6222b6479fe16 100644 --- a/docs/helm/helm_plugin_list.md +++ b/docs/helm/helm_plugin_list.md @@ -24,4 +24,4 @@ helm plugin list ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_plugin_remove.md b/docs/helm/helm_plugin_remove.md index ea21f17623df780efb7a87b1db2ed97d527be137..47c16f6e89055153e8ca58f18fe3684be50b3109 100644 --- a/docs/helm/helm_plugin_remove.md +++ b/docs/helm/helm_plugin_remove.md @@ -24,4 +24,4 @@ helm plugin remove <plugin>... ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_repo.md b/docs/helm/helm_repo.md index d53d50d1777c9ec7b2c3265bd9a2632de8f5cdfc..8e5d0da57b822642def3dc44620ff040ac1cbf74 100644 --- a/docs/helm/helm_repo.md +++ b/docs/helm/helm_repo.md @@ -31,4 +31,4 @@ Example usage: * [helm repo remove](helm_repo_remove.md) - remove a chart repository * [helm repo update](helm_repo_update.md) - update information on available charts in the chart repositories -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_repo_add.md b/docs/helm/helm_repo_add.md index 14499d91067291743d5f7f5755a2e2ae1466220e..5567fe4155c6da314f61b25a7615d38693566b83 100644 --- a/docs/helm/helm_repo_add.md +++ b/docs/helm/helm_repo_add.md @@ -33,4 +33,4 @@ helm repo add [flags] [NAME] [URL] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_repo_index.md b/docs/helm/helm_repo_index.md index f5a8b914c490fa8323840ccda4e0072bb59b1089..a98ecbffa0608bdb870576e30c4af6a19e7beeb1 100644 --- a/docs/helm/helm_repo_index.md +++ b/docs/helm/helm_repo_index.md @@ -40,4 +40,4 @@ helm repo index [flags] [DIR] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_repo_list.md b/docs/helm/helm_repo_list.md index 548b4a116024a4b54e2be0b0fddbb8f0203e9650..e5138458c2958012268be780b1b680c622a5a158 100644 --- a/docs/helm/helm_repo_list.md +++ b/docs/helm/helm_repo_list.md @@ -24,4 +24,4 @@ helm repo list [flags] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_repo_remove.md b/docs/helm/helm_repo_remove.md index 0227ce904e5654a3c452a9ab6ee09e3b14d8cfe1..0d1b1d06f4cac2e11076e19fa033060633a91040 100644 --- a/docs/helm/helm_repo_remove.md +++ b/docs/helm/helm_repo_remove.md @@ -24,4 +24,4 @@ helm repo remove [flags] [NAME] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_repo_update.md b/docs/helm/helm_repo_update.md index 544aba3ba7995c63a16e831dfc028fa29b636bd3..e3787cd568bfe734c1b90d2c5468a8d85e0eacb6 100644 --- a/docs/helm/helm_repo_update.md +++ b/docs/helm/helm_repo_update.md @@ -30,4 +30,4 @@ helm repo update ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_reset.md b/docs/helm/helm_reset.md index 73bfc74e8fb837b72c0a5607d3566e7ea63f85b2..e07f3a7075d68a7545460d09f6aa4e52c9dac510 100644 --- a/docs/helm/helm_reset.md +++ b/docs/helm/helm_reset.md @@ -40,4 +40,4 @@ helm reset ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_rollback.md b/docs/helm/helm_rollback.md index 425936a58076c1d0fedc779bbf919c0454455b38..a5500008c5ac73aba9b7b6039866e9fd510d52fd 100644 --- a/docs/helm/helm_rollback.md +++ b/docs/helm/helm_rollback.md @@ -45,4 +45,4 @@ helm rollback [flags] [RELEASE] [REVISION] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_search.md b/docs/helm/helm_search.md index 42ccdf0e47ab386c829cd618d102456d36908de6..238f922985276787bc88972605dfc06b0ae7f7bc 100644 --- a/docs/helm/helm_search.md +++ b/docs/helm/helm_search.md @@ -36,4 +36,4 @@ helm search [keyword] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_serve.md b/docs/helm/helm_serve.md index a78e52a8c08e9e8e5f97f69aa1bd41b3d0f88cf0..7c928c9a009ca53685893465a10347d71dbd9ecb 100644 --- a/docs/helm/helm_serve.md +++ b/docs/helm/helm_serve.md @@ -45,4 +45,4 @@ helm serve ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_status.md b/docs/helm/helm_status.md index 282ddaf638782a6808b4ace8122c0e9ac8687d15..893c3325ac9340cfc218327379ff0dfe479ec301 100644 --- a/docs/helm/helm_status.md +++ b/docs/helm/helm_status.md @@ -44,4 +44,4 @@ helm status [flags] RELEASE_NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_test.md b/docs/helm/helm_test.md index 9b7f5e571c8902623712f958c884881345c507ab..795a81c6638a055835193c8e24158a68acbe30d5 100644 --- a/docs/helm/helm_test.md +++ b/docs/helm/helm_test.md @@ -41,4 +41,4 @@ helm test [RELEASE] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index b49a035cf50f3cce3b4b3c5b14911fbead3e7430..931073937d426c5d119f096ccdf84a41b9ed8a3a 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -70,4 +70,4 @@ helm upgrade [RELEASE] [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_verify.md b/docs/helm/helm_verify.md index dd16e8115dd453fdf42db96369bbfdd74b2c146d..57ff2f191ccd0f7e5778653960068bd8664c20ba 100644 --- a/docs/helm/helm_verify.md +++ b/docs/helm/helm_verify.md @@ -39,4 +39,4 @@ helm verify [flags] PATH ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 11-Mar-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/helm/helm_version.md b/docs/helm/helm_version.md index ec536c54be4bb5c0c10fdb24d6e4d567240357e6..de65607b19ee406fa6cb6dd51a8b68ebbd78f899 100644 --- a/docs/helm/helm_version.md +++ b/docs/helm/helm_version.md @@ -53,4 +53,4 @@ helm version ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Apr-2017 +###### Auto generated by spf13/cobra on 16-Apr-2017 diff --git a/docs/man/man1/helm.1 b/docs/man/man1/helm.1 index 8aec63800fbcbae0034f1016d3fc17e0be630b3f..026ca69e4ce39e47d796ec754b9a9c3ccacbb04b 100644 --- a/docs/man/man1/helm.1 +++ b/docs/man/man1/helm.1 @@ -82,4 +82,4 @@ Environment: .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_completion.1 b/docs/man/man1/helm_completion.1 index 7202bdaf056207aa990697c1d8267f9b4368655d..0468bd4f4a0b5e34ab0e707d05f4105aa8eee660 100644 --- a/docs/man/man1/helm_completion.1 +++ b/docs/man/man1/helm_completion.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -71,4 +71,4 @@ $ source <(helm completion) .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_create.1 b/docs/man/man1/helm_create.1 index 3fe7be15b8beb9246915a56b618084430a2ac1f5..4261d753fd8b0a77825442374fc343d3d72ce72c 100644 --- a/docs/man/man1/helm_create.1 +++ b/docs/man/man1/helm_create.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -83,4 +83,4 @@ will be overwritten, but other files will be left alone. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_delete.1 b/docs/man/man1/helm_delete.1 index 548e4885b6a3f3be76f1d04b694083c9df58b467..3df4e0dedaed444ef0d061807c0f9ec75d6dc226 100644 --- a/docs/man/man1/helm_delete.1 +++ b/docs/man/man1/helm_delete.1 @@ -90,4 +90,4 @@ deleting them. .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_dependency.1 b/docs/man/man1/helm_dependency.1 index 70da6f2b533b0fff89f1ca8cad7be1f6baf25430..9287dcb1f704b45c2c1394d122860a7ab4f72064 100644 --- a/docs/man/man1/helm_dependency.1 +++ b/docs/man/man1/helm_dependency.1 @@ -114,4 +114,4 @@ for this case. .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_dependency_build.1 b/docs/man/man1/helm_dependency_build.1 index ad2d1afa0dd8975ac5cf141be10f17f2509630bb..a42f44a58c681c93939d7adefdcdd0d5825e9d13 100644 --- a/docs/man/man1/helm_dependency_build.1 +++ b/docs/man/man1/helm_dependency_build.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -66,4 +66,4 @@ of 'helm dependency update'. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_dependency_list.1 b/docs/man/man1/helm_dependency_list.1 index e4e1ae643586f22943420f14235b9b2bd70e6a73..9061d3ebe2e148791eeba4603798697dd23412a3 100644 --- a/docs/man/man1/helm_dependency_list.1 +++ b/docs/man/man1/helm_dependency_list.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -55,4 +55,4 @@ if it cannot find a requirements.yaml. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_dependency_update.1 b/docs/man/man1/helm_dependency_update.1 index 99594d9b992bc964ba1e465cf80a2ee8a75283a0..eebee95d7218bc36cbe7fca23406d464ca0f563a 100644 --- a/docs/man/man1/helm_dependency_update.1 +++ b/docs/man/man1/helm_dependency_update.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -75,4 +75,4 @@ in the requirements.yaml file, but (b) at the wrong version. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_fetch.1 b/docs/man/man1/helm_fetch.1 index 1ae76f24dddf5097e1c12adaa6147d09f5463a34..0de710574a3ee6f921ae8d3623267d67b8a51ec5 100644 --- a/docs/man/man1/helm_fetch.1 +++ b/docs/man/man1/helm_fetch.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -91,4 +91,4 @@ result in an error, and the chart will not be saved locally. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_get.1 b/docs/man/man1/helm_get.1 index bbc8515cae8d7df78487b588ee28ab2a2d27c427..6a5f96a20de4c0d76f9f2e59283b5fd040c33e2f 100644 --- a/docs/man/man1/helm_get.1 +++ b/docs/man/man1/helm_get.1 @@ -86,4 +86,4 @@ chart, the supplied values, and the generated manifest file. .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_get_hooks.1 b/docs/man/man1/helm_get_hooks.1 index 8299690c290b6a3220e9409102a41484b9ef223d..8ba348e54a333af5eef34ea1f6a516b3e2de008e 100644 --- a/docs/man/man1/helm_get_hooks.1 +++ b/docs/man/man1/helm_get_hooks.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -56,4 +56,4 @@ Hooks are formatted in YAML and separated by the YAML '\-\-\-\\n' separator. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_get_manifest.1 b/docs/man/man1/helm_get_manifest.1 index 8093058ae0c616f4bbee41d9293e9a4d9c023768..21fa6363c69712bd5e89c5483aebfbe5917e9cca 100644 --- a/docs/man/man1/helm_get_manifest.1 +++ b/docs/man/man1/helm_get_manifest.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -58,4 +58,4 @@ charts, those resources will also be included in the manifest. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_get_values.1 b/docs/man/man1/helm_get_values.1 index 21e7efb6e2c1ebd26b39a70ee18a968febd4ce7d..c897e7378287a44153344e272a2397e1c650bb10 100644 --- a/docs/man/man1/helm_get_values.1 +++ b/docs/man/man1/helm_get_values.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -57,4 +57,4 @@ This command downloads a values file for a given release. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_history.1 b/docs/man/man1/helm_history.1 index e4915c45a6f4cbf8fa10a0ab7d31a17a608fcf13..cde92fa82af90c4d75dc77ad223cbb1007c4c8a3 100644 --- a/docs/man/man1/helm_history.1 +++ b/docs/man/man1/helm_history.1 @@ -94,4 +94,4 @@ REVISION UPDATED STATUS CHART DESCRIPTIO .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_home.1 b/docs/man/man1/helm_home.1 index 8e12c50536c51542f6d2dfe95a4da08b7309934a..a0887aac486cb417e462893ad48c9189e41c4587 100644 --- a/docs/man/man1/helm_home.1 +++ b/docs/man/man1/helm_home.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -48,4 +48,4 @@ any helm configuration files live. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_init.1 b/docs/man/man1/helm_init.1 index df69c6d29a19c4dcd8ac7c9dedbcd7e4a9e2ebf7..dfd801ef8568f1f49e48498a2e693044d2b530fa 100644 --- a/docs/man/man1/helm_init.1 +++ b/docs/man/man1/helm_init.1 @@ -124,4 +124,4 @@ To dump a manifest containing the Tiller deployment YAML, combine the .SH HISTORY .PP -13\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_inspect.1 b/docs/man/man1/helm_inspect.1 index 29b68fa8658b92194ad4e3b2573ddc7281832d0d..bce08dfcd12f4aa2fbc776fc358e89e42d12b458 100644 --- a/docs/man/man1/helm_inspect.1 +++ b/docs/man/man1/helm_inspect.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -65,4 +65,4 @@ Inspect prints the contents of the Chart.yaml file and the values.yaml file. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_inspect_chart.1 b/docs/man/man1/helm_inspect_chart.1 index 8e3246d843f7a49c69d3371849c1a29f8967ffaa..892a5f6d1ed9627daf79453c233f06e8269a8711 100644 --- a/docs/man/man1/helm_inspect_chart.1 +++ b/docs/man/man1/helm_inspect_chart.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -62,4 +62,4 @@ of the Charts.yaml file .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_inspect_values.1 b/docs/man/man1/helm_inspect_values.1 index f16f04007f95a4fe2de2d3842440c9730fff94dd..ed46871bd21a35e2f1e82e004b5ff2b031031b4e 100644 --- a/docs/man/man1/helm_inspect_values.1 +++ b/docs/man/man1/helm_inspect_values.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -62,4 +62,4 @@ of the values.yaml file .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_install.1 b/docs/man/man1/helm_install.1 index d97ff0058e670c747324870a550d841886ad1453..521680e504486a7bcaafd3f41fcaa923f602ad45 100644 --- a/docs/man/man1/helm_install.1 +++ b/docs/man/man1/helm_install.1 @@ -216,4 +216,4 @@ charts in a repository, use 'helm search'. .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_lint.1 b/docs/man/man1/helm_lint.1 index f285516ffe4cb44f897a77b539042484f2796815..0ade88c5acb310c7c45e586348e5bd6bbd9547d9 100644 --- a/docs/man/man1/helm_lint.1 +++ b/docs/man/man1/helm_lint.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -59,4 +59,4 @@ or recommendation, it will emit [WARNING] messages. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_list.1 b/docs/man/man1/helm_list.1 index 8fbdf09c4406b8a3075b1ec5f92e245d925e828d..aef144aa70b8187e9c7a708a1f3e84c58467cba4 100644 --- a/docs/man/man1/helm_list.1 +++ b/docs/man/man1/helm_list.1 @@ -148,4 +148,4 @@ flag with the '\-\-offset' flag allows you to page through results. .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_package.1 b/docs/man/man1/helm_package.1 index 205d52980c1f2b84b900690e0a159cee2d7d9e49..b50ef10d6dc60d838c11906d4fa6999d1a1677ef 100644 --- a/docs/man/man1/helm_package.1 +++ b/docs/man/man1/helm_package.1 @@ -82,4 +82,4 @@ Versioned chart archives are used by Helm package repositories. .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_plugin.1 b/docs/man/man1/helm_plugin.1 index 2a126161edc3aa9ceb7a674eb4ca1830bb64c399..36bae074fb7962a286287843222096714c8eede6 100644 --- a/docs/man/man1/helm_plugin.1 +++ b/docs/man/man1/helm_plugin.1 @@ -47,4 +47,4 @@ Manage client\-side Helm plugins. .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_plugin_install.1 b/docs/man/man1/helm_plugin_install.1 index ea987eb70b4d8575655c23e5212ebb1b260322b3..fc4378048402256eda278cf74ca1d361bbd32291 100644 --- a/docs/man/man1/helm_plugin_install.1 +++ b/docs/man/man1/helm_plugin_install.1 @@ -53,4 +53,4 @@ install one or more Helm plugins .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_plugin_list.1 b/docs/man/man1/helm_plugin_list.1 index d68023d8193ec5cd1fb8f3d8fedd88527f75687f..0db846a2c679721523185c3e2ff4ce66064f7e6e 100644 --- a/docs/man/man1/helm_plugin_list.1 +++ b/docs/man/man1/helm_plugin_list.1 @@ -47,4 +47,4 @@ list installed Helm plugins .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_plugin_remove.1 b/docs/man/man1/helm_plugin_remove.1 index ed876d58b0dc0b366735dafc2ec28d6a61529b8b..9d3a20057539fc638bdb5177ea222e7a87af7f07 100644 --- a/docs/man/man1/helm_plugin_remove.1 +++ b/docs/man/man1/helm_plugin_remove.1 @@ -47,4 +47,4 @@ remove one or more Helm plugins .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_repo.1 b/docs/man/man1/helm_repo.1 index 1de66514439af691e036a9be43845b392f4a9f98..e073dabcf85bedf03ff3c5cfd8b379136267124f 100644 --- a/docs/man/man1/helm_repo.1 +++ b/docs/man/man1/helm_repo.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -52,4 +52,4 @@ Example usage: .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_repo_add.1 b/docs/man/man1/helm_repo_add.1 index 15a63f96c72cdc47eaa9e98ea3a72c3d7c6ff43a..19e2606acf54ce85782c01a865fd05085a5b8891 100644 --- a/docs/man/man1/helm_repo_add.1 +++ b/docs/man/man1/helm_repo_add.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -65,4 +65,4 @@ add a chart repository .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_repo_index.1 b/docs/man/man1/helm_repo_index.1 index bf2d4a05510d65f8d81f24cb2296cddb76d30e2d..260fa97f38ab8eb8936c15fded172eddf710ba49 100644 --- a/docs/man/man1/helm_repo_index.1 +++ b/docs/man/man1/helm_repo_index.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -66,4 +66,4 @@ into the existing index, with local charts taking priority over existing charts. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_repo_list.1 b/docs/man/man1/helm_repo_list.1 index 1c2222ec94808e619f32898ea80af8dfd439b9f2..33a97d8168fe5f435e9839457413c8e417d95ddb 100644 --- a/docs/man/man1/helm_repo_list.1 +++ b/docs/man/man1/helm_repo_list.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -47,4 +47,4 @@ list chart repositories .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_repo_remove.1 b/docs/man/man1/helm_repo_remove.1 index daac022c42f203a6d0df85fd7f8f02758f58fae4..b6d48a50d4b73026832f4f1a7ab510378e82970c 100644 --- a/docs/man/man1/helm_repo_remove.1 +++ b/docs/man/man1/helm_repo_remove.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -47,4 +47,4 @@ remove a chart repository .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_repo_update.1 b/docs/man/man1/helm_repo_update.1 index 0e201ad626a93245f6f44c9d461f6ad93004d185..1a46691e975147a052ada8453f2b74ae2d21d907 100644 --- a/docs/man/man1/helm_repo_update.1 +++ b/docs/man/man1/helm_repo_update.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -52,4 +52,4 @@ future releases. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_reset.1 b/docs/man/man1/helm_reset.1 index 0284a068a1b4eea8ec64a9ae0908a7834a07f272..6d600d1d2436f9a041300f5cc8f122f5f49f5b48 100644 --- a/docs/man/man1/helm_reset.1 +++ b/docs/man/man1/helm_reset.1 @@ -79,4 +79,4 @@ $HELM\_HOME (default \~/.helm/) .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_rollback.1 b/docs/man/man1/helm_rollback.1 index 0346790b6ab0a800498a2638804db5c44bc720dc..909573969cf9cf92a3642a2a703c200f2fbe4edc 100644 --- a/docs/man/man1/helm_rollback.1 +++ b/docs/man/man1/helm_rollback.1 @@ -94,4 +94,4 @@ second is a revision (version) number. To see revision numbers, run .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_search.1 b/docs/man/man1/helm_search.1 index 43518167936691bba3851cdb9a21068e577ff44d..639f957eb654f588d455ce8a303a531953dcc432 100644 --- a/docs/man/man1/helm_search.1 +++ b/docs/man/man1/helm_search.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -61,4 +61,4 @@ Repositories are managed with 'helm repo' commands. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_serve.1 b/docs/man/man1/helm_serve.1 index 6cb80593e9ede8e2fb67c4818dd0d389a1c3d09e..a01385ac286979b81aeb67175922debe76ae2086 100644 --- a/docs/man/man1/helm_serve.1 +++ b/docs/man/man1/helm_serve.1 @@ -76,4 +76,4 @@ for more information on hosting chart repositories in a production setting. .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_status.1 b/docs/man/man1/helm_status.1 index 9709917c76d32d68b2fb05378adf864f9537f85c..380ef03a818c30769aca122d9e8db4d0db7a22e2 100644 --- a/docs/man/man1/helm_status.1 +++ b/docs/man/man1/helm_status.1 @@ -80,4 +80,4 @@ The status consists of: .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_test.1 b/docs/man/man1/helm_test.1 index fd933d3fc1ca3d91cf37411841a99f05462df533..5936f81eeb57e84209f3003e8af8c0b2138e5ae1 100644 --- a/docs/man/man1/helm_test.1 +++ b/docs/man/man1/helm_test.1 @@ -81,4 +81,4 @@ The tests to be run are defined in the chart that was installed. .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_upgrade.1 b/docs/man/man1/helm_upgrade.1 index c458a84ef362ef587ad61285860aa10c9b3a60f2..0190285b618dc181fb71b11ab5a3eebcd37dff15 100644 --- a/docs/man/man1/helm_upgrade.1 +++ b/docs/man/man1/helm_upgrade.1 @@ -163,4 +163,4 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_verify.1 b/docs/man/man1/helm_verify.1 index 2520c6a2c9aa1a6b2818bbf782b4afd07f83ae55..dcd18e7fda1ccb04258ae87749e90018c5c89f86 100644 --- a/docs/man/man1/helm_verify.1 +++ b/docs/man/man1/helm_verify.1 @@ -1,4 +1,4 @@ -.TH "HELM" "1" "Mar 2017" "Auto generated by spf13/cobra" "" +.TH "HELM" "1" "Apr 2017" "Auto generated by spf13/cobra" "" .nh .ad l @@ -62,4 +62,4 @@ the 'helm package \-\-sign' command. .SH HISTORY .PP -11\-Mar\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/docs/man/man1/helm_version.1 b/docs/man/man1/helm_version.1 index 5e3e9dd6209e8ebe6ef7dc57f518e86ce4d84ddc..f97acf6da374908429d0500a6b7ef8ccb931f2db 100644 --- a/docs/man/man1/helm_version.1 +++ b/docs/man/man1/helm_version.1 @@ -100,4 +100,4 @@ use '\-\-server'. .SH HISTORY .PP -12\-Apr\-2017 Auto generated by spf13/cobra +16\-Apr\-2017 Auto generated by spf13/cobra diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 065df8b7548ddabbe63415f083a5e388a4729f7e..1a4c3a7a95dbc66f387835ae10007a9f1ee39ae2 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -16,17 +16,16 @@ limitations under the License. package downloader import ( - "bytes" "errors" "fmt" "io" "io/ioutil" - "net/http" "net/url" "os" "path/filepath" "strings" + "k8s.io/helm/pkg/getter" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/provenance" "k8s.io/helm/pkg/repo" @@ -66,6 +65,8 @@ type ChartDownloader struct { Keyring string // HelmHome is the $HELM_HOME. HelmHome helmpath.Home + // Getter collection for the operation + Getters []getter.Prop } // DownloadTo retrieves a chart. Depending on the settings, it may also download a provenance file. @@ -80,13 +81,12 @@ type ChartDownloader struct { // Returns a string path to the location where the file was downloaded and a verification // (if provenance was verified), or an error if something bad happened. func (c *ChartDownloader) DownloadTo(ref, version, dest string) (string, *provenance.Verification, error) { - var r repo.Getter - u, r, err := c.ResolveChartVersion(ref, version) + u, g, err := c.ResolveChartVersion(ref, version) if err != nil { return "", nil, err } - data, err := download(u.String(), r) + data, err := g.Get(u.String()) if err != nil { return "", nil, err } @@ -100,7 +100,7 @@ func (c *ChartDownloader) DownloadTo(ref, version, dest string) (string, *proven // If provenance is requested, verify it. ver := &provenance.Verification{} if c.Verify > VerifyNever { - body, err := download(u.String()+".prov", r) + body, err := g.Get(u.String() + ".prov") if err != nil { if c.Verify == VerifyAlways { return destfile, ver, fmt.Errorf("Failed to fetch provenance %q", u.String()+".prov") @@ -139,7 +139,7 @@ func (c *ChartDownloader) DownloadTo(ref, version, dest string) (string, *proven // * If version is non-empty, this will return the URL for that version // * If version is empty, this will return the URL for the latest version // * If no version can be found, an error is returned -func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, repo.Getter, error) { +func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, getter.Getter, error) { u, err := url.Parse(ref) if err != nil { return nil, nil, fmt.Errorf("invalid chart URL format: %s", ref) @@ -161,14 +161,19 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, re // If there is no special config, return the default HTTP client and // swallow the error. if err == ErrNoOwnerRepo { - return u, http.DefaultClient, nil + getterConstructor, err := getter.ConstructorByScheme(c.Getters, u.Scheme) + if err != nil { + return u, nil, err + } + getter, err := getterConstructor(ref, "", "", "") + return u, getter, err } return u, nil, err } - r, err := repo.NewChartRepository(rc) + r, err := repo.NewChartRepository(rc, c.Getters) // If we get here, we don't need to go through the next phase of looking // up the URL. We have it already. So we just return. - return u, r, err + return u, r.Client, err } // See if it's of the form: repo/path_to_chart @@ -184,7 +189,7 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, re return u, nil, err } - r, err := repo.NewChartRepository(rc) + r, err := repo.NewChartRepository(rc, c.Getters) if err != nil { return u, nil, err } @@ -192,25 +197,25 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, re // Next, we need to load the index, and actually look up the chart. i, err := repo.LoadIndexFile(c.HelmHome.CacheIndex(r.Config.Name)) if err != nil { - return u, r, fmt.Errorf("no cached repo found. (try 'helm repo update'). %s", err) + return u, r.Client, fmt.Errorf("no cached repo found. (try 'helm repo update'). %s", err) } cv, err := i.Get(chartName, version) if err != nil { - return u, r, fmt.Errorf("chart %q not found in %s index. (try 'helm repo update'). %s", chartName, r.Config.Name, err) + return u, r.Client, fmt.Errorf("chart %q not found in %s index. (try 'helm repo update'). %s", chartName, r.Config.Name, err) } if len(cv.URLs) == 0 { - return u, r, fmt.Errorf("chart %q has no downloadable URLs", ref) + return u, r.Client, fmt.Errorf("chart %q has no downloadable URLs", ref) } // TODO: Seems that picking first URL is not fully correct u, err = url.Parse(cv.URLs[0]) if err != nil { - return u, r, fmt.Errorf("invalid chart URL format: %s", ref) + return u, r.Client, fmt.Errorf("invalid chart URL format: %s", ref) } - return u, r, nil + return u, r.Client, nil } // VerifyChart takes a path to a chart archive and a keyring, and verifies the chart. @@ -239,23 +244,6 @@ func VerifyChart(path string, keyring string) (*provenance.Verification, error) return sig.Verify(path, provfile) } -// download performs a Get from repo.Getter and returns the body. -func download(href string, r repo.Getter) (*bytes.Buffer, error) { - buf := bytes.NewBuffer(nil) - - resp, err := r.Get(href) - if err != nil { - return buf, err - } - if resp.StatusCode != 200 { - return buf, fmt.Errorf("Failed to fetch %s : %s", href, resp.Status) - } - - _, err = io.Copy(buf, resp.Body) - resp.Body.Close() - return buf, err -} - // isTar tests whether the given file is a tar file. // // Currently, this simply checks extension, since a subsequent function will @@ -298,7 +286,7 @@ func (c *ChartDownloader) scanReposForURL(u string, rf *repo.RepoFile) (*repo.En // FIXME: This is far from optimal. Larger installations and index files will // incur a performance hit for this type of scanning. for _, rc := range rf.Repositories { - r, err := repo.NewChartRepository(rc) + r, err := repo.NewChartRepository(rc, c.Getters) if err != nil { return nil, err } diff --git a/pkg/downloader/chart_downloader_test.go b/pkg/downloader/chart_downloader_test.go index 9edcb98a36a300723c257aedf2e99dd1e9f9792a..17a66145b42341858b14bffffb355503dba0a30b 100644 --- a/pkg/downloader/chart_downloader_test.go +++ b/pkg/downloader/chart_downloader_test.go @@ -25,6 +25,9 @@ import ( "path/filepath" "testing" + "k8s.io/helm/pkg/getter/defaultgetters" + "k8s.io/helm/pkg/getter/http" + "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/repo/repotest" @@ -49,6 +52,7 @@ func TestResolveChartRef(t *testing.T) { c := ChartDownloader{ HelmHome: helmpath.Home("testdata/helmhome"), Out: os.Stderr, + Getters: defaultgetters.Get(environment.EnvSettings{}), } for _, tt := range tests { @@ -85,7 +89,11 @@ func TestDownload(t *testing.T) { })) defer srv.Close() - got, err := download(srv.URL, http.DefaultClient) + getter, err := httpgetter.New(srv.URL, "", "", "") + if err != nil { + t.Fatal(err) + } + got, err := getter.Get(srv.URL) if err != nil { t.Fatal(err) } @@ -106,7 +114,7 @@ func TestDownload(t *testing.T) { u, _ := url.ParseRequestURI(basicAuthSrv.URL) u.User = url.UserPassword("username", "password") - got, err = download(u.String(), http.DefaultClient) + got, err = getter.Get(u.String()) if err != nil { t.Fatal(err) } @@ -174,6 +182,7 @@ func TestDownloadTo(t *testing.T) { Out: os.Stderr, Verify: VerifyAlways, Keyring: "testdata/helm-test-key.pub", + Getters: defaultgetters.Get(environment.EnvSettings{}), } cname := "/signtest-0.1.0.tgz" where, v, err := c.DownloadTo(srv.URL()+cname, "", dest) @@ -236,6 +245,7 @@ func TestDownloadTo_VerifyLater(t *testing.T) { HelmHome: hh, Out: os.Stderr, Verify: VerifyLater, + Getters: defaultgetters.Get(environment.EnvSettings{}), } cname := "/signtest-0.1.0.tgz" where, _, err := c.DownloadTo(srv.URL()+cname, "", dest) @@ -264,6 +274,7 @@ func TestScanReposForURL(t *testing.T) { HelmHome: hh, Out: os.Stderr, Verify: VerifyLater, + Getters: defaultgetters.Get(environment.EnvSettings{}), } u := "http://example.com/alpine-0.2.0.tgz" diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index e9a509306d55ccb249b3c5d80f96043e2a007050..4f881591a11a9c024efe44ee37dc7b301942cea7 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -31,6 +31,7 @@ import ( "github.com/ghodss/yaml" "k8s.io/helm/pkg/chartutil" + "k8s.io/helm/pkg/getter" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/repo" @@ -54,6 +55,8 @@ type Manager struct { Keyring string // SkipUpdate indicates that the repository should not be updated first. SkipUpdate bool + // Getter collection for the operation + Getters []getter.Prop } // Build rebuilds a local charts directory from a lockfile. @@ -199,6 +202,7 @@ func (m *Manager) downloadAll(deps []*chartutil.Dependency) error { Verify: m.Verify, Keyring: m.Keyring, HelmHome: m.HelmHome, + Getters: m.Getters, } destPath := filepath.Join(m.ChartPath, "charts") @@ -389,7 +393,7 @@ func (m *Manager) parallelRepoUpdate(repos []*repo.Entry) error { fmt.Fprintln(out, "Hang tight while we grab the latest from your chart repositories...") var wg sync.WaitGroup for _, c := range repos { - r, err := repo.NewChartRepository(c) + r, err := repo.NewChartRepository(c, m.Getters) if err != nil { return err } diff --git a/pkg/getter/defaultgetters/default.go b/pkg/getter/defaultgetters/default.go new file mode 100644 index 0000000000000000000000000000000000000000..8e5f0c862648cbfad4329a6bde55b4294ca96ac8 --- /dev/null +++ b/pkg/getter/defaultgetters/default.go @@ -0,0 +1,71 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package defaultgetters + +import ( + "os" + + "k8s.io/helm/pkg/getter" + "k8s.io/helm/pkg/getter/http" + "k8s.io/helm/pkg/getter/plugin" + "k8s.io/helm/pkg/helm/environment" + "k8s.io/helm/pkg/helm/helmpath" + "k8s.io/helm/pkg/plugin" +) + +// Get gathers the getter constructors for the downloaders. +// Currently the build-in http getter and the discovered +// plugins with downloader notations are collected. +func Get(settings environment.EnvSettings) []getter.Prop { + result := []getter.Prop{ + { + Schemes: getter.Schemes{"http", "https"}, + Constructor: httpgetter.New, + }, + } + pluginDownloaders, _ := collectPlugins(settings) + result = append(result, pluginDownloaders...) + return result +} + +func collectPlugins(settings environment.EnvSettings) ([]getter.Prop, error) { + plugdirs := os.Getenv(environment.PluginEnvVar) + if plugdirs == "" { + home := helmpath.Home(os.Getenv(environment.HomeEnvVar)) + plugdirs = home.Plugins() + } + + plugins, err := plugin.FindPlugins(plugdirs) + if err != nil { + return nil, err + } + var result []getter.Prop + for _, plugin := range plugins { + for _, downloader := range plugin.Metadata.Downloaders { + result = append(result, getter.Prop{ + Schemes: downloader.Protocols, + Constructor: plugingetter.ConstructNew( + downloader.Command, + settings, + plugin.Metadata.Name, + plugin.Dir, + ), + }) + } + } + return result, nil +} diff --git a/pkg/getter/getter.go b/pkg/getter/getter.go new file mode 100644 index 0000000000000000000000000000000000000000..c8b131f31f51f5c125c1a71492951c285efb45c0 --- /dev/null +++ b/pkg/getter/getter.go @@ -0,0 +1,53 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package getter + +import ( + "bytes" + "fmt" +) + +// Getter is an interface to support GET to the specified URL. +type Getter interface { + //Get file content by url string + Get(url string) (*bytes.Buffer, error) +} + +//Schemes is the list to represent a specific Getter's protocol capabilities +type Schemes []string + +//Constructor is the function for every getter which creates a specific instance +//according to the configuration +type Constructor func(URL, CertFile, KeyFile, CAFile string) (Getter, error) + +//Prop represents any getter and its capability +type Prop struct { + Schemes Schemes + Constructor Constructor +} + +//ConstructorByScheme returns a contstructor based on the required scheme +func ConstructorByScheme(props []Prop, requiredScheme string) (Constructor, error) { + for _, item := range props { + for _, itemScheme := range item.Schemes { + if itemScheme == requiredScheme { + return item.Constructor, nil + } + } + } + return nil, fmt.Errorf("Getter not found") +} diff --git a/pkg/getter/http/http_getter.go b/pkg/getter/http/http_getter.go new file mode 100644 index 0000000000000000000000000000000000000000..57f6c742f4a6058574173e1cc86e451e9a73890f --- /dev/null +++ b/pkg/getter/http/http_getter.go @@ -0,0 +1,77 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package httpgetter + +import ( + "bytes" + "fmt" + "io" + "net/http" + + "k8s.io/helm/pkg/getter" + "k8s.io/helm/pkg/tlsutil" + "k8s.io/helm/pkg/urlutil" +) + +//HTTPGetter is the efault HTTP(/S) backend handler +type HTTPGetter struct { + client *http.Client +} + +//Get performs a Get from repo.Getter and returns the body. +func (g *HTTPGetter) Get(href string) (*bytes.Buffer, error) { + buf := bytes.NewBuffer(nil) + + resp, err := g.client.Get(href) + if err != nil { + return buf, err + } + if resp.StatusCode != 200 { + return buf, fmt.Errorf("Failed to fetch %s : %s", href, resp.Status) + } + + _, err = io.Copy(buf, resp.Body) + resp.Body.Close() + return buf, err +} + +//New constructs a valid http/https client as Getter +func New(URL, CertFile, KeyFile, CAFile string) (getter.Getter, error) { + var client HTTPGetter + if CertFile != "" && KeyFile != "" && CAFile != "" { + tlsConf, err := tlsutil.NewClientTLS(CertFile, KeyFile, CAFile) + if err != nil { + return nil, fmt.Errorf("can't create TLS config for client: %s", err.Error()) + } + tlsConf.BuildNameToCertificate() + + sni, err := urlutil.ExtractHostname(URL) + if err != nil { + return nil, err + } + tlsConf.ServerName = sni + + client.client = &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: tlsConf, + }, + } + } else { + client.client = http.DefaultClient + } + return &client, nil +} diff --git a/pkg/getter/plugin/plugin_getter.go b/pkg/getter/plugin/plugin_getter.go new file mode 100644 index 0000000000000000000000000000000000000000..3ae600591f02dc427ee509e80016617b7d06b60c --- /dev/null +++ b/pkg/getter/plugin/plugin_getter.go @@ -0,0 +1,76 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package plugingetter + +import ( + "bytes" + "fmt" + "os" + "os/exec" + "path/filepath" + + "k8s.io/helm/pkg/getter" + "k8s.io/helm/pkg/helm/environment" + "k8s.io/helm/pkg/plugin" +) + +// PluginGetter is a generic type to invoke custom downloaders, +// implemented in plugins. +type PluginGetter struct { + command string + certFile, keyFile, cAFile string + settings environment.EnvSettings + name string + base string +} + +// Get runs downloader plugin command +func (p *PluginGetter) Get(href string) (*bytes.Buffer, error) { + argv := []string{p.certFile, p.keyFile, p.cAFile, href} + prog := exec.Command(filepath.Join(p.base, p.command), argv...) + plugin.SetupPluginEnv(p.settings, p.name, p.base) + prog.Env = os.Environ() + buf := bytes.NewBuffer(nil) + prog.Stdout = buf + prog.Stderr = os.Stderr + if err := prog.Run(); err != nil { + if eerr, ok := err.(*exec.ExitError); ok { + os.Stderr.Write(eerr.Stderr) + return nil, fmt.Errorf("plugin %q exited with error", p.command) + } + return nil, err + } + return buf, nil +} + +// ConstructNew constructs a valid plugin getter +func ConstructNew(command string, + settings environment.EnvSettings, + name string, + base string) getter.Constructor { + return func(URL, CertFile, KeyFile, CAFile string) (getter.Getter, error) { + result := &PluginGetter{ + command: command, + certFile: CertFile, + keyFile: KeyFile, + cAFile: CAFile, + settings: settings, + name: name, + base: base, + } + return result, nil + } +} diff --git a/pkg/helm/environment/environment.go b/pkg/helm/environment/environment.go new file mode 100644 index 0000000000000000000000000000000000000000..6a24a624c72388286e3a50f99e31145d0bda0163 --- /dev/null +++ b/pkg/helm/environment/environment.go @@ -0,0 +1,56 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/*Package environment describes the operating environment for Tiller. + +Tiller's environment encapsulates all of the service dependencies Tiller has. +These dependencies are expressed as interfaces so that alternate implementations +(mocks, etc.) can be easily generated. +*/ +package environment + +import ( + "os" + "path/filepath" + + "k8s.io/helm/pkg/helm/helmpath" +) + +const ( + HomeEnvVar = "HELM_HOME" + PluginEnvVar = "HELM_PLUGIN" + PluginDisableEnvVar = "HELM_NO_PLUGINS" + HostEnvVar = "HELM_HOST" +) + +func DefaultHelmHome() string { + if home := os.Getenv(HomeEnvVar); home != "" { + return home + } + return filepath.Join(os.Getenv("HOME"), ".helm") +} + +func DefaultHelmHost() string { + return os.Getenv(HostEnvVar) +} + +type EnvSettings struct { + TillerHost string + TillerNamespace string + Home helmpath.Home + PlugDirs string + FlagDebug bool +} diff --git a/pkg/plugin/plugin.go b/pkg/plugin/plugin.go index e0f307ace9151d9769f519e94dd275351e9585ce..6bcb5a1861753d4ac46ad66c692e47884fa06d99 100644 --- a/pkg/plugin/plugin.go +++ b/pkg/plugin/plugin.go @@ -21,11 +21,23 @@ import ( "path/filepath" "strings" + helm_env "k8s.io/helm/pkg/helm/environment" + tiller_env "k8s.io/helm/pkg/tiller/environment" + "github.com/ghodss/yaml" ) -// PluginFileName is the name of a plugin file. -const PluginFileName = "plugin.yaml" +const pluginFileName = "plugin.yaml" + +// Downloaders represents the plugins capability if it can retrieve +// charts from special sources +type Downloaders struct { + // Protocols are the list of schemes from the charts URL. + Protocols []string `json:"protocols"` + // Command is the executable path with which the plugin performs + // the actual download for the corresponding Protocols + Command string `json:"command"` +} // Metadata describes a plugin. // @@ -67,6 +79,10 @@ type Metadata struct { // Hooks are commands that will run on events. Hooks Hooks + + // Downloaders field is used if the plugin supply downloader mechanism + // for special protocols. + Downloaders []Downloaders `json:"downloaders"` } // Plugin represents a plugin. @@ -98,7 +114,7 @@ func (p *Plugin) PrepareCommand(extraArgs []string) (string, []string) { // LoadDir loads a plugin from the given directory. func LoadDir(dirname string) (*Plugin, error) { - data, err := ioutil.ReadFile(filepath.Join(dirname, PluginFileName)) + data, err := ioutil.ReadFile(filepath.Join(dirname, pluginFileName)) if err != nil { return nil, err } @@ -116,7 +132,7 @@ func LoadDir(dirname string) (*Plugin, error) { func LoadAll(basedir string) ([]*Plugin, error) { plugins := []*Plugin{} // We want basedir/*/plugin.yaml - scanpath := filepath.Join(basedir, "*", PluginFileName) + scanpath := filepath.Join(basedir, "*", pluginFileName) matches, err := filepath.Glob(scanpath) if err != nil { return plugins, err @@ -136,3 +152,50 @@ func LoadAll(basedir string) ([]*Plugin, error) { } return plugins, nil } + +// FindPlugins returns a list of YAML files that describe plugins. +func FindPlugins(plugdirs string) ([]*Plugin, error) { + found := []*Plugin{} + // Let's get all UNIXy and allow path separators + for _, p := range filepath.SplitList(plugdirs) { + matches, err := LoadAll(p) + if err != nil { + return matches, err + } + found = append(found, matches...) + } + return found, nil +} + +// SetupPluginEnv prepares os.Env for plugins. It operates on os.Env because +// the plugin subsystem itself needs access to the environment variables +// created here. +func SetupPluginEnv(settings helm_env.EnvSettings, + shortName, base string) { + for key, val := range map[string]string{ + "HELM_PLUGIN_NAME": shortName, + "HELM_PLUGIN_DIR": base, + "HELM_BIN": os.Args[0], + + // Set vars that may not have been set, and save client the + // trouble of re-parsing. + helm_env.PluginEnvVar: settings.PlugDirs, + helm_env.HomeEnvVar: settings.Home.String(), + + // Set vars that convey common information. + "HELM_PATH_REPOSITORY": settings.Home.Repository(), + "HELM_PATH_REPOSITORY_FILE": settings.Home.RepositoryFile(), + "HELM_PATH_CACHE": settings.Home.Cache(), + "HELM_PATH_LOCAL_REPOSITORY": settings.Home.LocalRepository(), + "HELM_PATH_STARTER": settings.Home.Starters(), + + "TILLER_HOST": settings.TillerHost, + tiller_env.TillerNamespaceEnvVar: settings.TillerNamespace, + } { + os.Setenv(key, val) + } + + if settings.FlagDebug { + os.Setenv("HELM_DEBUG", "1") + } +} diff --git a/pkg/plugin/plugin_test.go b/pkg/plugin/plugin_test.go index e0abb91073148d48da4140ee50375279d2b57835..5ddbf15f3e99d410f7f75ecf8e15530a01ae0781 100644 --- a/pkg/plugin/plugin_test.go +++ b/pkg/plugin/plugin_test.go @@ -92,6 +92,36 @@ func TestLoadDir(t *testing.T) { } } +func TestDownloader(t *testing.T) { + dirname := "testdata/plugdir/downloader" + plug, err := LoadDir(dirname) + if err != nil { + t.Fatalf("error loading Hello plugin: %s", err) + } + + if plug.Dir != dirname { + t.Errorf("Expected dir %q, got %q", dirname, plug.Dir) + } + + expect := &Metadata{ + Name: "downloader", + Version: "1.2.3", + Usage: "usage", + Description: "download something", + Command: "echo Hello", + Downloaders: []Downloaders{ + { + Protocols: []string{"myprotocol", "myprotocols"}, + Command: "echo Download", + }, + }, + } + + if !reflect.DeepEqual(expect, plug.Metadata) { + t.Errorf("Expected metadata %v, got %v", expect, plug.Metadata) + } +} + func TestLoadAll(t *testing.T) { // Verify that empty dir loads: @@ -107,14 +137,17 @@ func TestLoadAll(t *testing.T) { t.Fatalf("Could not load %q: %s", basedir, err) } - if l := len(plugs); l != 2 { - t.Fatalf("expected 2 plugins, found %d", l) + if l := len(plugs); l != 3 { + t.Fatalf("expected 3 plugins, found %d", l) } - if plugs[0].Metadata.Name != "echo" { + if plugs[0].Metadata.Name != "downloader" { + t.Errorf("Expected first plugin to be echo, got %q", plugs[0].Metadata.Name) + } + if plugs[1].Metadata.Name != "echo" { t.Errorf("Expected first plugin to be echo, got %q", plugs[0].Metadata.Name) } - if plugs[1].Metadata.Name != "hello" { + if plugs[2].Metadata.Name != "hello" { t.Errorf("Expected second plugin to be hello, got %q", plugs[1].Metadata.Name) } } diff --git a/pkg/plugin/testdata/plugdir/downloader/plugin.yaml b/pkg/plugin/testdata/plugdir/downloader/plugin.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c0b90379bee2535b414025ba792394a82bc65743 --- /dev/null +++ b/pkg/plugin/testdata/plugdir/downloader/plugin.yaml @@ -0,0 +1,11 @@ +name: "downloader" +version: "1.2.3" +usage: "usage" +description: |- + download something +command: "echo Hello" +downloaders: + - protocols: + - "myprotocol" + - "myprotocols" + command: "echo Download" diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index 601d36eadcf6bb026eef30915d2534bdcb32f108..d7a4267f8186959e79187fc2ec55e0eb4f98e802 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -19,7 +19,7 @@ package repo // import "k8s.io/helm/pkg/repo" import ( "fmt" "io/ioutil" - "net/http" + "net/url" "os" "path/filepath" "strings" @@ -27,9 +27,8 @@ import ( "github.com/ghodss/yaml" "k8s.io/helm/pkg/chartutil" + "k8s.io/helm/pkg/getter" "k8s.io/helm/pkg/provenance" - "k8s.io/helm/pkg/tlsutil" - "k8s.io/helm/pkg/urlutil" ) // Entry represents a collection of parameters for chart repository @@ -47,37 +46,23 @@ type ChartRepository struct { Config *Entry ChartPaths []string IndexFile *IndexFile - Client *http.Client -} - -// Getter is an interface to support GET to the specified URL. -type Getter interface { - Get(url string) (*http.Response, error) + Client getter.Getter } // NewChartRepository constructs ChartRepository -func NewChartRepository(cfg *Entry) (*ChartRepository, error) { - var client *http.Client - if cfg.CertFile != "" && cfg.KeyFile != "" && cfg.CAFile != "" { - tlsConf, err := tlsutil.NewClientTLS(cfg.CertFile, cfg.KeyFile, cfg.CAFile) - if err != nil { - return nil, fmt.Errorf("can't create TLS config for client: %s", err.Error()) - } - tlsConf.BuildNameToCertificate() - - sni, err := urlutil.ExtractHostname(cfg.URL) - if err != nil { - return nil, err - } - tlsConf.ServerName = sni +func NewChartRepository(cfg *Entry, getters []getter.Prop) (*ChartRepository, error) { + u, err := url.Parse(cfg.URL) + if err != nil { + return nil, fmt.Errorf("invalid chart URL format: %s", cfg.URL) + } - client = &http.Client{ - Transport: &http.Transport{ - TLSClientConfig: tlsConf, - }, - } - } else { - client = http.DefaultClient + getterConstructor, err := getter.ConstructorByScheme(getters, u.Scheme) + if err != nil { + return nil, fmt.Errorf("Could not find protocol handler for: %s", u.Scheme) + } + client, _ := getterConstructor(cfg.URL, cfg.CertFile, cfg.KeyFile, cfg.CAFile) + if err != nil { + return nil, fmt.Errorf("Could not construct protocol handler for: %s", u.Scheme) } return &ChartRepository{ @@ -87,15 +72,6 @@ func NewChartRepository(cfg *Entry) (*ChartRepository, error) { }, nil } -// Get issues a GET using configured client to the specified URL. -func (r *ChartRepository) Get(url string) (*http.Response, error) { - resp, err := r.Client.Get(url) - if err != nil { - return nil, err - } - return resp, nil -} - // Load loads a directory of charts as if it were a repository. // // It requires the presence of an index.yaml file in the directory. @@ -136,13 +112,12 @@ func (r *ChartRepository) DownloadIndexFile(cachePath string) error { var indexURL string indexURL = strings.TrimSuffix(r.Config.URL, "/") + "/index.yaml" - resp, err := r.Get(indexURL) + resp, err := r.Client.Get(indexURL) if err != nil { return err } - defer resp.Body.Close() - index, err := ioutil.ReadAll(resp.Body) + index, err := ioutil.ReadAll(resp) if err != nil { return err } diff --git a/pkg/repo/chartrepo_test.go b/pkg/repo/chartrepo_test.go index 7148e39a4763ae8dc373a01fb8f75cb6f7164a2e..bab5019d88b47f38e3122d4757c3554c5fffa979 100644 --- a/pkg/repo/chartrepo_test.go +++ b/pkg/repo/chartrepo_test.go @@ -23,6 +23,8 @@ import ( "testing" "time" + "k8s.io/helm/pkg/getter/defaultgetters" + "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/proto/hapi/chart" ) @@ -35,7 +37,7 @@ func TestLoadChartRepository(t *testing.T) { r, err := NewChartRepository(&Entry{ Name: testRepository, URL: testURL, - }) + }, defaultgetters.Get(environment.EnvSettings{})) if err != nil { t.Errorf("Problem creating chart repository from %s: %v", testRepository, err) } @@ -67,7 +69,7 @@ func TestIndex(t *testing.T) { r, err := NewChartRepository(&Entry{ Name: testRepository, URL: testURL, - }) + }, defaultgetters.Get(environment.EnvSettings{})) if err != nil { t.Errorf("Problem creating chart repository from %s: %v", testRepository, err) } diff --git a/pkg/repo/index_test.go b/pkg/repo/index_test.go index 9eca229968e3d04bbe278b507fbe7c0926f5c229..c82e0e72787a94090a1bc2ab5bbc62e8b9f51d26 100644 --- a/pkg/repo/index_test.go +++ b/pkg/repo/index_test.go @@ -24,6 +24,8 @@ import ( "path/filepath" "testing" + "k8s.io/helm/pkg/getter/defaultgetters" + "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/proto/hapi/chart" ) @@ -150,7 +152,7 @@ func TestDownloadIndexFile(t *testing.T) { Name: testRepo, URL: srv.URL, Cache: indexFilePath, - }) + }, defaultgetters.Get(environment.EnvSettings{})) if err != nil { t.Errorf("Problem creating chart repository from %s: %v", testRepo, err) } diff --git a/pkg/repo/repotest/server.go b/pkg/repo/repotest/server.go index 1a0a270d7a9c624644b6b90fa0bb44422462155d..8ea9103a0190fc414685530f1f7f251bae59a086 100644 --- a/pkg/repo/repotest/server.go +++ b/pkg/repo/repotest/server.go @@ -35,21 +35,22 @@ import ( // // The caller is responsible for destroying the temp directory as well as stopping // the server. -func NewTempServer(glob string) (*Server, string, error) { +func NewTempServer(glob string) (*Server, helmpath.Home, error) { tdir, err := ioutil.TempDir("", "helm-repotest-") + tdirh := helmpath.Home(tdir) if err != nil { - return nil, tdir, err + return nil, tdirh, err } srv := NewServer(tdir) if glob != "" { if _, err := srv.CopyCharts(glob); err != nil { srv.Stop() - return srv, tdir, err + return srv, tdirh, err } } - return srv, tdir, nil + return srv, tdirh, nil } // NewServer creates a repository server for testing. diff --git a/pkg/repo/repotest/server_test.go b/pkg/repo/repotest/server_test.go index 1d4c78e415868cff0e7707dfd1dce78d1d1df16b..61c056172b9f47eab027a6451f28e18964a902a9 100644 --- a/pkg/repo/repotest/server_test.go +++ b/pkg/repo/repotest/server_test.go @@ -110,10 +110,10 @@ func TestNewTempServer(t *testing.T) { } defer func() { srv.Stop() - os.RemoveAll(tdir) + os.RemoveAll(tdir.String()) }() - if _, err := os.Stat(tdir); err != nil { + if _, err := os.Stat(tdir.String()); err != nil { t.Fatal(err) } diff --git a/pkg/tiller/environment/environment.go b/pkg/tiller/environment/environment.go index d218818e8f3c0364bf4d44f44928696e2d69de1b..26516474b3e66bc95ab9d15e5452f0e2184904a7 100644 --- a/pkg/tiller/environment/environment.go +++ b/pkg/tiller/environment/environment.go @@ -24,6 +24,7 @@ package environment import ( "io" + "os" "time" "k8s.io/helm/pkg/chartutil" @@ -36,9 +37,21 @@ import ( "k8s.io/kubernetes/pkg/kubectl/resource" ) +// TillerNamespaceEnvVar is the environment variable name for the tiller +// namespace in the kubernetes cluster. +const TillerNamespaceEnvVar = "TILLER_NAMESPACE" + // DefaultTillerNamespace is the default namespace for tiller. const DefaultTillerNamespace = "kube-system" +// GetTillerNamespace returns the right tiller namespace. +func GetTillerNamespace() string { + if ns := os.Getenv(TillerNamespaceEnvVar); ns != "" { + return ns + } + return DefaultTillerNamespace +} + // GoTplEngine is the name of the Go template engine, as registered in the EngineYard. const GoTplEngine = "gotpl"