talos/internal/pkg/kubeconfig/kubeconfig.go
Andrey Smirnov 90d0efec48 feat: pull kubeconfig from the cluster on successful cluster create
Kubeconfig is merged into `~/.kube/config` with rename option
(existing configuration is never overwritten).

If endpoint was used, it is automatically put into the `kubeconfig`.

This should make OS X experience literally `talosctl cluster create`
followed by any `kubectl get ...`.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-10-06 05:45:28 -07:00

22 lines
526 B
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package kubeconfig provides Kubernetes config file handling.
package kubeconfig
import (
"os"
"path/filepath"
)
// DefaultPath returns path to ~/.kube/config.
func DefaultPath() (string, error) {
home, err := os.UserHomeDir()
if err != nil {
return "", err
}
return filepath.Join(home, ".kube/config"), nil
}