fixed stutter

pull/5003/head
Medya Gh 2019-08-06 15:43:16 -07:00
parent df624349c3
commit ffe573ec48
5 changed files with 15 additions and 15 deletions

View File

@ -401,7 +401,7 @@ func showVersionInfo(k8sVersion string, cr cruntime.Manager) {
} }
} }
func showKubectlConnectInfo(kubeconfig *kubeconfig.KubeConfigSetup) { func showKubectlConnectInfo(kubeconfig *kubeconfig.Setup) {
if kubeconfig.KeepContext { if kubeconfig.KeepContext {
out.T(out.Kubectl, "To connect to this cluster, use: kubectl --context={{.name}}", out.V{"name": kubeconfig.ClusterName}) out.T(out.Kubectl, "To connect to this cluster, use: kubectl --context={{.name}}", out.V{"name": kubeconfig.ClusterName})
} else { } else {

View File

@ -67,7 +67,7 @@ func SetupCerts(cmd command.Runner, k8s config.KubernetesConfig) error {
copyableFiles = append(copyableFiles, certFile) copyableFiles = append(copyableFiles, certFile)
} }
kubeCfgSetup := &kubeconfig.KubeConfigSetup{ kubeCfgSetup := &kubeconfig.Setup{
ClusterName: k8s.NodeName, ClusterName: k8s.NodeName,
ClusterServerAddress: fmt.Sprintf("https://localhost:%d", k8s.NodePort), ClusterServerAddress: fmt.Sprintf("https://localhost:%d", k8s.NodePort),
ClientCertificate: path.Join(util.DefaultCertPath, "apiserver.crt"), ClientCertificate: path.Join(util.DefaultCertPath, "apiserver.crt"),

View File

@ -35,8 +35,8 @@ import (
pkgutil "k8s.io/minikube/pkg/util" pkgutil "k8s.io/minikube/pkg/util"
) )
// KubeConfigSetup is the kubeconfig setup // Setup is the kubeconfig setup
type KubeConfigSetup struct { type Setup struct {
// The name of the cluster for this context // The name of the cluster for this context
ClusterName string ClusterName string
@ -64,17 +64,17 @@ type KubeConfigSetup struct {
} }
// SetKubeConfigFile sets the kubeconfig file // SetKubeConfigFile sets the kubeconfig file
func (k *KubeConfigSetup) SetKubeConfigFile(kubeConfigFile string) { func (k *Setup) SetKubeConfigFile(kubeConfigFile string) {
k.kubeConfigFile.Store(kubeConfigFile) k.kubeConfigFile.Store(kubeConfigFile)
} }
// GetKubeConfigFile gets the kubeconfig file // GetKubeConfigFile gets the kubeconfig file
func (k *KubeConfigSetup) GetKubeConfigFile() string { func (k *Setup) GetKubeConfigFile() string {
return k.kubeConfigFile.Load().(string) return k.kubeConfigFile.Load().(string)
} }
// PopulateKubeConfig populates an api.Config object. // 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 var err error
clusterName := cfg.ClusterName clusterName := cfg.ClusterName
cluster := api.NewCluster() 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. // SetupKubeConfig reads config from disk, adds the minikube settings, and writes it back.
// activeContext is true when minikube is the CurrentContext // activeContext is true when minikube is the CurrentContext
// If no CurrentContext is set, the given name will be used. // 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()) glog.Infoln("Using kubeconfig: ", cfg.GetKubeConfigFile())
// read existing config or create new if does not exist // read existing config or create new if does not exist

View File

@ -25,7 +25,7 @@ import (
"testing" "testing"
"k8s.io/client-go/tools/clientcmd/api" "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" "k8s.io/client-go/tools/clientcmd"
) )
@ -97,7 +97,7 @@ users:
`) `)
func TestSetupKubeConfig(t *testing.T) { func TestSetupKubeConfig(t *testing.T) {
setupCfg := &KubeConfigSetup{ setupCfg := &Setup{
ClusterName: "test", ClusterName: "test",
ClusterServerAddress: "192.168.1.1:8080", ClusterServerAddress: "192.168.1.1:8080",
ClientCertificate: "/home/apiserver.crt", ClientCertificate: "/home/apiserver.crt",
@ -108,7 +108,7 @@ func TestSetupKubeConfig(t *testing.T) {
var tests = []struct { var tests = []struct {
description string description string
cfg *KubeConfigSetup cfg *Setup
existingCfg []byte existingCfg []byte
expected api.Config expected api.Config
err bool err bool
@ -128,7 +128,7 @@ func TestSetupKubeConfig(t *testing.T) {
}, },
{ {
description: "keep context", description: "keep context",
cfg: &KubeConfigSetup{ cfg: &Setup{
ClusterName: "test", ClusterName: "test",
ClusterServerAddress: "192.168.1.1:8080", ClusterServerAddress: "192.168.1.1:8080",
ClientCertificate: "/home/apiserver.crt", ClientCertificate: "/home/apiserver.crt",
@ -524,7 +524,7 @@ func minikubeConfig(config *api.Config) {
// cluster // cluster
clusterName := "minikube" clusterName := "minikube"
cluster := api.NewCluster() 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" cluster.CertificateAuthority = "/home/tux/.minikube/apiserver.crt"
config.Clusters[clusterName] = cluster config.Clusters[clusterName] = cluster

View File

@ -28,7 +28,7 @@ import (
) )
// Update sets up kubeconfig to be used by kubectl // 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() addr, err := h.Driver.GetURL()
if err != nil { if err != nil {
exit.WithError("Failed to get driver URL", err) 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) addr = strings.Replace(addr, c.KubernetesConfig.NodeIP, c.KubernetesConfig.APIServerName, -1)
} }
kcs := &KubeConfigSetup{ kcs := &Setup{
ClusterName: cfg.GetMachineName(), ClusterName: cfg.GetMachineName(),
ClusterServerAddress: addr, ClusterServerAddress: addr,
ClientCertificate: constants.MakeMiniPath("client.crt"), ClientCertificate: constants.MakeMiniPath("client.crt"),