Merge pull request #233 from cuisongliu/bugfix/join_issue

feature(devlop): fix clean bug  / join master
This commit is contained in:
cuisongliu
2020-03-20 00:17:05 +08:00
committed by GitHub
2 changed files with 14 additions and 7 deletions
+3 -2
View File
@@ -79,8 +79,8 @@ func (s *SealosInstaller) Clean() {
cleanNode(node)
}(node)
}
wg.Wait()
}
wg.Wait()
if len(s.Masters) > 0 {
//2. 先删除master
for _, master := range s.Masters {
@@ -90,8 +90,9 @@ func (s *SealosInstaller) Clean() {
cleanMaster(master)
}(master)
}
wg.Wait()
}
wg.Wait()
}
func cleanNode(node string) {
+11 -5
View File
@@ -3,6 +3,8 @@ package install
import (
"fmt"
"github.com/fanux/sealos/ipvs"
"github.com/wonderivan/logger"
"strings"
"sync"
)
@@ -52,13 +54,17 @@ func joinNodesFunc(joinNodes []string) {
}
//GeneratorToken is
//这里主要是为了获取CertificateKey
func (s *SealosInstaller) GeneratorCerts() {
cmd := `kubeadm init phase upload-certs --upload-certs`
output := SSHConfig.Cmd(s.Masters[0], cmd)
decodeCertCmd(output)
cmd = fmt.Sprintf("kubeadm token create --certificate-key %s --print-join-command", CertificateKey)
output = SSHConfig.Cmd(s.Masters[0], cmd)
decodeOutput(output)
output := SSHConfig.CmdToString(s.Masters[0], cmd)
logger.Debug("[globals]decodeCertCmd: %s", output)
slice := strings.Split(output, "Using certificate key:\r\n")
slice1 := strings.Split(slice[1], "\r\n")
CertificateKey = slice1[0]
cmd = "kubeadm token create --print-join-command"
out := SSHConfig.Cmd(s.Masters[0], cmd)
decodeOutput(out)
}
//GeneratorToken is