add option to bypass kubeconfig namespace

Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
pull/7373/head
Patrik Cyvoct 5 years ago
parent f35719a62a
commit ff0e008558
No known key found for this signature in database
GPG Key ID: 4334D82B950FB63A

@ -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
}

Loading…
Cancel
Save