Merge pull request #6798 from aaronmell/Make_Namespace_Public

Allow namespace to be set by programs consuming helm.
pull/6786/head
Matthew Fisher 6 years ago committed by GitHub
commit f1dc84773f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -67,7 +67,7 @@ func main() {
actionConfig := new(action.Configuration) actionConfig := new(action.Configuration)
cmd := newRootCmd(actionConfig, os.Stdout, os.Args[1:]) cmd := newRootCmd(actionConfig, os.Stdout, os.Args[1:])
if err := actionConfig.Init(settings, false, os.Getenv("HELM_DRIVER"), debug); err != nil { if err := actionConfig.Init(settings.RESTClientGetter(), settings.Namespace(), os.Getenv("HELM_DRIVER"), debug); err != nil {
debug("%+v", err) debug("%+v", err)
os.Exit(1) os.Exit(1)
} }

@ -70,7 +70,7 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
Args: require.NoArgs, Args: require.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
if client.AllNamespaces { if client.AllNamespaces {
if err := cfg.Init(settings, true, os.Getenv("HELM_DRIVER"), debug); err != nil { if err := cfg.Init(settings.RESTClientGetter(), "", os.Getenv("HELM_DRIVER"), debug); err != nil {
return err return err
} }
} }

@ -22,13 +22,13 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/api/meta"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/client-go/discovery" "k8s.io/client-go/discovery"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
"helm.sh/helm/v3/internal/experimental/registry" "helm.sh/helm/v3/internal/experimental/registry"
"helm.sh/helm/v3/pkg/chartutil" "helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/kube" "helm.sh/helm/v3/pkg/kube"
"helm.sh/helm/v3/pkg/release" "helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/storage" "helm.sh/helm/v3/pkg/storage"
@ -210,9 +210,7 @@ func (c *Configuration) recordRelease(r *release.Release) {
} }
// InitActionConfig initializes the action configuration // InitActionConfig initializes the action configuration
func (c *Configuration) Init(envSettings *cli.EnvSettings, allNamespaces bool, helmDriver string, log DebugLog) error { func (c *Configuration) Init(getter genericclioptions.RESTClientGetter, namespace string, helmDriver string, log DebugLog) error {
getter := envSettings.RESTClientGetter()
kc := kube.New(getter) kc := kube.New(getter)
kc.Log = log kc.Log = log
@ -220,10 +218,6 @@ func (c *Configuration) Init(envSettings *cli.EnvSettings, allNamespaces bool, h
if err != nil { if err != nil {
return err return err
} }
var namespace string
if !allNamespaces {
namespace = envSettings.Namespace()
}
var store *storage.Storage var store *storage.Storage
switch helmDriver { switch helmDriver {

Loading…
Cancel
Save