fixed stutter
parent
df624349c3
commit
ffe573ec48
|
@ -401,7 +401,7 @@ func showVersionInfo(k8sVersion string, cr cruntime.Manager) {
|
|||
}
|
||||
}
|
||||
|
||||
func showKubectlConnectInfo(kubeconfig *kubeconfig.KubeConfigSetup) {
|
||||
func showKubectlConnectInfo(kubeconfig *kubeconfig.Setup) {
|
||||
if kubeconfig.KeepContext {
|
||||
out.T(out.Kubectl, "To connect to this cluster, use: kubectl --context={{.name}}", out.V{"name": kubeconfig.ClusterName})
|
||||
} else {
|
||||
|
|
|
@ -67,7 +67,7 @@ func SetupCerts(cmd command.Runner, k8s config.KubernetesConfig) error {
|
|||
copyableFiles = append(copyableFiles, certFile)
|
||||
}
|
||||
|
||||
kubeCfgSetup := &kubeconfig.KubeConfigSetup{
|
||||
kubeCfgSetup := &kubeconfig.Setup{
|
||||
ClusterName: k8s.NodeName,
|
||||
ClusterServerAddress: fmt.Sprintf("https://localhost:%d", k8s.NodePort),
|
||||
ClientCertificate: path.Join(util.DefaultCertPath, "apiserver.crt"),
|
||||
|
|
|
@ -35,8 +35,8 @@ import (
|
|||
pkgutil "k8s.io/minikube/pkg/util"
|
||||
)
|
||||
|
||||
// KubeConfigSetup is the kubeconfig setup
|
||||
type KubeConfigSetup struct {
|
||||
// Setup is the kubeconfig setup
|
||||
type Setup struct {
|
||||
// The name of the cluster for this context
|
||||
ClusterName string
|
||||
|
||||
|
@ -64,17 +64,17 @@ type KubeConfigSetup struct {
|
|||
}
|
||||
|
||||
// SetKubeConfigFile sets the kubeconfig file
|
||||
func (k *KubeConfigSetup) SetKubeConfigFile(kubeConfigFile string) {
|
||||
func (k *Setup) SetKubeConfigFile(kubeConfigFile string) {
|
||||
k.kubeConfigFile.Store(kubeConfigFile)
|
||||
}
|
||||
|
||||
// GetKubeConfigFile gets the kubeconfig file
|
||||
func (k *KubeConfigSetup) GetKubeConfigFile() string {
|
||||
func (k *Setup) GetKubeConfigFile() string {
|
||||
return k.kubeConfigFile.Load().(string)
|
||||
}
|
||||
|
||||
// PopulateKubeConfig populates an api.Config object.
|
||||
func PopulateKubeConfig(cfg *KubeConfigSetup, kubecfg *api.Config) error {
|
||||
func PopulateKubeConfig(cfg *Setup, kubecfg *api.Config) error {
|
||||
var err error
|
||||
clusterName := cfg.ClusterName
|
||||
cluster := api.NewCluster()
|
||||
|
@ -125,7 +125,7 @@ func PopulateKubeConfig(cfg *KubeConfigSetup, kubecfg *api.Config) error {
|
|||
// SetupKubeConfig reads config from disk, adds the minikube settings, and writes it back.
|
||||
// activeContext is true when minikube is the CurrentContext
|
||||
// If no CurrentContext is set, the given name will be used.
|
||||
func SetupKubeConfig(cfg *KubeConfigSetup) error {
|
||||
func SetupKubeConfig(cfg *Setup) error {
|
||||
glog.Infoln("Using kubeconfig: ", cfg.GetKubeConfigFile())
|
||||
|
||||
// read existing config or create new if does not exist
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"k8s.io/client-go/tools/clientcmd/api"
|
||||
"k8s.io/minikube/pkg/minikube/bootstrapper/kubeadm"
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
)
|
||||
|
@ -97,7 +97,7 @@ users:
|
|||
`)
|
||||
|
||||
func TestSetupKubeConfig(t *testing.T) {
|
||||
setupCfg := &KubeConfigSetup{
|
||||
setupCfg := &Setup{
|
||||
ClusterName: "test",
|
||||
ClusterServerAddress: "192.168.1.1:8080",
|
||||
ClientCertificate: "/home/apiserver.crt",
|
||||
|
@ -108,7 +108,7 @@ func TestSetupKubeConfig(t *testing.T) {
|
|||
|
||||
var tests = []struct {
|
||||
description string
|
||||
cfg *KubeConfigSetup
|
||||
cfg *Setup
|
||||
existingCfg []byte
|
||||
expected api.Config
|
||||
err bool
|
||||
|
@ -128,7 +128,7 @@ func TestSetupKubeConfig(t *testing.T) {
|
|||
},
|
||||
{
|
||||
description: "keep context",
|
||||
cfg: &KubeConfigSetup{
|
||||
cfg: &Setup{
|
||||
ClusterName: "test",
|
||||
ClusterServerAddress: "192.168.1.1:8080",
|
||||
ClientCertificate: "/home/apiserver.crt",
|
||||
|
@ -524,7 +524,7 @@ func minikubeConfig(config *api.Config) {
|
|||
// cluster
|
||||
clusterName := "minikube"
|
||||
cluster := api.NewCluster()
|
||||
cluster.Server = "https://192.168.99.100:" + strconv.Itoa(kubeadm.APIServerPort)
|
||||
cluster.Server = "https://192.168.99.100:" + strconv.Itoa(constants.APIServerPort)
|
||||
cluster.CertificateAuthority = "/home/tux/.minikube/apiserver.crt"
|
||||
config.Clusters[clusterName] = cluster
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import (
|
|||
)
|
||||
|
||||
// Update sets up kubeconfig to be used by kubectl
|
||||
func Update(h *host.Host, c *cfg.Config) *KubeConfigSetup {
|
||||
func Update(h *host.Host, c *cfg.Config) *Setup {
|
||||
addr, err := h.Driver.GetURL()
|
||||
if err != nil {
|
||||
exit.WithError("Failed to get driver URL", err)
|
||||
|
@ -39,7 +39,7 @@ func Update(h *host.Host, c *cfg.Config) *KubeConfigSetup {
|
|||
addr = strings.Replace(addr, c.KubernetesConfig.NodeIP, c.KubernetesConfig.APIServerName, -1)
|
||||
}
|
||||
|
||||
kcs := &KubeConfigSetup{
|
||||
kcs := &Setup{
|
||||
ClusterName: cfg.GetMachineName(),
|
||||
ClusterServerAddress: addr,
|
||||
ClientCertificate: constants.MakeMiniPath("client.crt"),
|
||||
|
|
Loading…
Reference in New Issue