credentialprovider: Sets homeDirPath to os.UserHomeDir()

Currently, the credential provider will look in the path set in
the $HOME env variable, but that environment does not exist on
Windows, but $HOMEPATH does. Because of this, if credentials are
set in ~/.docker on Windows, they will not be used by kubelet
when pulling images.

The function os.UserHomeDir can solve this problem [1].

[1] https://golang.org/pkg/os/#UserHomeDir
k3s-v1.15.3
Claudiu Belu 2019-05-25 12:52:32 -07:00
parent 44a3bf4755
commit 16da70c249
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ var (
preferredPathLock sync.Mutex
preferredPath = ""
workingDirPath = ""
homeDirPath = os.Getenv("HOME")
homeDirPath, _ = os.UserHomeDir()
rootDirPath = "/"
homeJsonDirPath = filepath.Join(homeDirPath, ".docker")
rootJsonDirPath = filepath.Join(rootDirPath, ".docker")