Replace server name in updateKubeConfig if --apiserver-name exists #3878

pull/3897/head
u5surf 2019-03-18 22:13:59 +09:00
parent 016e3f3178
commit a34a9d32e6
1 changed files with 3 additions and 0 deletions

View File

@ -443,6 +443,9 @@ func updateKubeConfig(h *host.Host, c *cfg.Config) *kubeconfig.KubeConfigSetup {
}
addr = strings.Replace(addr, "tcp://", "https://", -1)
addr = strings.Replace(addr, ":2376", ":"+strconv.Itoa(c.KubernetesConfig.NodePort), -1)
if c.KubernetesConfig.APIServerName != constants.APIServerName {
addr = strings.Replace(addr, c.KubernetesConfig.NodeIP, c.KubernetesConfig.APIServerName, -1)
}
kcs := &kubeconfig.KubeConfigSetup{
ClusterName: cfg.GetMachineName(),