From ff0e0085580a9131665f691006fb4d8699d6a95b Mon Sep 17 00:00:00 2001 From: Patrik Cyvoct Date: Fri, 10 Jan 2020 09:05:57 +0100 Subject: [PATCH] add option to bypass kubeconfig namespace Signed-off-by: Patrik Cyvoct --- pkg/kube/client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index cdd996925..ed4a3cf65 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -55,6 +55,8 @@ var ErrNoObjectsVisited = errors.New("no objects visited") type Client struct { Factory Factory Log func(string, ...interface{}) + // Namespace allows to bypass the kubeconfig file for the choice of the namespace + Namespace string } // New creates a new Client. @@ -113,6 +115,9 @@ func (c *Client) Wait(resources ResourceList, timeout time.Duration) error { } func (c *Client) namespace() string { + if c.Namespace != "" { + return c.Namespace + } if ns, _, err := c.Factory.ToRawKubeConfigLoader().Namespace(); err == nil { return ns }