diff --git a/pkg/action/action.go b/pkg/action/action.go index 71edf7bd5..28d88c3ed 100644 --- a/pkg/action/action.go +++ b/pkg/action/action.go @@ -211,7 +211,7 @@ func (c *Configuration) recordRelease(r *release.Release) { // InitActionConfig initializes the action configuration 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.Log = log diff --git a/pkg/cli/environment.go b/pkg/cli/environment.go index 6958c04a9..28e7873be 100644 --- a/pkg/cli/environment.go +++ b/pkg/cli/environment.go @@ -38,8 +38,7 @@ import ( // EnvSettings describes all of the environment settings. type EnvSettings struct { - namespace string - //kubeConfig string + namespace string config genericclioptions.RESTClientGetter configOnce sync.Once @@ -116,14 +115,14 @@ func (s *EnvSettings) Namespace() string { return s.namespace } - if ns, _, err := s.RestClientGetter().ToRawKubeConfigLoader().Namespace(); err == nil { + if ns, _, err := s.RESTClientGetter().ToRawKubeConfigLoader().Namespace(); err == nil { return ns } return "default" } -//KubeConfig gets the kubeconfig from EnvSettings -func (s *EnvSettings) RestClientGetter() genericclioptions.RESTClientGetter { +//RESTClientGetter gets the kubeconfig from EnvSettings +func (s *EnvSettings) RESTClientGetter() genericclioptions.RESTClientGetter { s.configOnce.Do(func() { s.config = kube.GetConfig(s.KubeConfig, s.KubeContext, s.namespace) })