Code Review Changes

Signed-off-by: Aaron Mell <amell@lumindigital.com>
pull/6660/head
Aaron Mell 6 years ago
parent 4eca26e4e1
commit 6a98d1f1d2

@ -211,7 +211,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(envSettings *cli.EnvSettings, allNamespaces bool, helmDriver string, log DebugLog) error {
getter := envSettings.RestClientGetter() getter := envSettings.RESTClientGetter()
kc := kube.New(getter) kc := kube.New(getter)
kc.Log = log kc.Log = log

@ -39,7 +39,6 @@ import (
// EnvSettings describes all of the environment settings. // EnvSettings describes all of the environment settings.
type EnvSettings struct { type EnvSettings struct {
namespace string namespace string
//kubeConfig string
config genericclioptions.RESTClientGetter config genericclioptions.RESTClientGetter
configOnce sync.Once configOnce sync.Once
@ -116,14 +115,14 @@ func (s *EnvSettings) Namespace() string {
return s.namespace return s.namespace
} }
if ns, _, err := s.RestClientGetter().ToRawKubeConfigLoader().Namespace(); err == nil { if ns, _, err := s.RESTClientGetter().ToRawKubeConfigLoader().Namespace(); err == nil {
return ns return ns
} }
return "default" return "default"
} }
//KubeConfig gets the kubeconfig from EnvSettings //RESTClientGetter gets the kubeconfig from EnvSettings
func (s *EnvSettings) RestClientGetter() genericclioptions.RESTClientGetter { func (s *EnvSettings) RESTClientGetter() genericclioptions.RESTClientGetter {
s.configOnce.Do(func() { s.configOnce.Do(func() {
s.config = kube.GetConfig(s.KubeConfig, s.KubeContext, s.namespace) s.config = kube.GetConfig(s.KubeConfig, s.KubeContext, s.namespace)
}) })

Loading…
Cancel
Save