danielfoehrKn/kubeswitch

KUBECONF variable is missing drive-letter(C:) on windows

Opened this issue · 1 comments

Hi, running this on Windows.
When working in a path(say d:/myproject) on another drive-letter from where your user profile is(say c:/users/username/) no kubectl commands work since kubectl can not find the temporary kubeconf file.

The issue seem to be that enviroment variable KUBECONF get set to /Users/username/.kube/.switch_tmp/config.1549310098.tmp which is a relative path to the drive you are working on...
Manually doing something like
$env:KUBECONFIG = 'C:'+$env:KUBECONFIG
that is prepending the drive-letter, fixes this.

Would be awsome if kubeswitch wouldn't loose the drive letter.. don't really se why/where that happens since it seems to read $HOME which is correct and os.expandenv which is use also preserves the drive letter...

Best regards and cheers

I assume this is something you can temporarily fix.

In the installation steps you Source the shell functions (https://github.com/danielfoehrKn/kubeswitch/blob/master/docs/installation.md#powershell). Afterwards you can manually edit the powershell script.
In the script you find the method "kubeswitch" and within it you can find the replacement of the drive letter

$KUBECONFIG_PATH = $KUBECONFIG_PATH -replace "C:", ""

Once you get this working, it's probably an easy fix that you can provide to the community through a PR over this file:

$KUBECONFIG_PATH = $KUBECONFIG_PATH -replace "C:", ""