use client-go util to get homedir

This commit is contained in:
Benjamin Elder
2019-01-15 11:08:41 -08:00
parent 53dfeedc16
commit 074fb785b3

View File

@@ -18,9 +18,10 @@ package meta
import (
"fmt"
"os"
"path/filepath"
"k8s.io/client-go/util/homedir"
"sigs.k8s.io/kind/pkg/cluster/consts"
)
@@ -46,9 +47,8 @@ func (c *ClusterMeta) Name() string {
// KubeConfigPath returns the path to where the Kubeconfig would be placed
// by kind based on the configuration.
func (c *ClusterMeta) KubeConfigPath() string {
// TODO(bentheelder): Windows?
// configDir matches the standard directory expected by kubectl etc
configDir := filepath.Join(os.Getenv("HOME"), ".kube")
configDir := filepath.Join(homedir.HomeDir(), ".kube")
// note that the file name however does not, we do not want to overwrite
// the standard config, though in the future we may (?) merge them
fileName := fmt.Sprintf("kind-config-%s", c.name)