From 73e2721bd7d250a616998ac0e02960f84386c319 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 21 Nov 2019 11:03:03 +0800 Subject: [PATCH] feat add a function to set namespace of envsetting, to provied easier integration for non-cli projects Signed-off-by: mike.du --- pkg/cli/environment.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/cli/environment.go b/pkg/cli/environment.go index 28e7873be..77de2bf52 100644 --- a/pkg/cli/environment.go +++ b/pkg/cli/environment.go @@ -121,6 +121,14 @@ func (s *EnvSettings) Namespace() string { return "default" } +/* +Set the namespace for service integration purpose +provide a way to set namespace for easier integration with non-cli projects + */ +func (s *EnvSettings) SetNamespace(ns string) { + s.namespace = ns +} + //RESTClientGetter gets the kubeconfig from EnvSettings func (s *EnvSettings) RESTClientGetter() genericclioptions.RESTClientGetter { s.configOnce.Do(func() {