fix: use-case while in cluster, connecting to an external (#623)

Signed-off-by: Aris Boutselis <arisboutselis08@gmail.com>
Co-authored-by: Aris Boutselis <arisboutselis08@gmail.com>
This commit is contained in:
Aris Boutselis
2023-09-01 09:09:11 +01:00
committed by GitHub
parent fc90dc865b
commit 1a7f45cc55

View File

@@ -37,7 +37,7 @@ func (c *Client) GetRestClient() rest.Interface {
func NewClient(kubecontext string, kubeconfig string) (*Client, error) {
var config *rest.Config
config, err := rest.InClusterConfig()
if err != nil {
if kubeconfig != "" || err != nil {
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
if kubeconfig != "" {