Skip to content

Commit

Permalink
feat(develop): 修复join时候kubeadm找不到的问题
Browse files Browse the repository at this point in the history
feat(develop): 修复join时候kubeadm找不到的问题
  • Loading branch information
cuisongliu authored May 17, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 091b44c + ea72022 commit 76f1c20
Showing 3 changed files with 5 additions and 19 deletions.
2 changes: 2 additions & 0 deletions install/clean.go
Original file line number Diff line number Diff line change
@@ -151,6 +151,8 @@ func clean(host string) {
_ = SSHConfig.CmdAsync(host, cmd)
cmd = "rm -rf /usr/bin/kube* && rm -rf /usr/bin/crictl"
_ = SSHConfig.CmdAsync(host, cmd)
cmd = "rm -rf /usr/bin/sealos"
_ = SSHConfig.CmdAsync(host, cmd)
cmd = "rm -rf /etc/cni && rm -rf /opt/cni"
_ = SSHConfig.CmdAsync(host, cmd)
cmd = "rm -rf /var/lib/etcd && rm -rf /var/etcd"
1 change: 0 additions & 1 deletion install/init.go
Original file line number Diff line number Diff line change
@@ -27,7 +27,6 @@ func BuildInit() {
i.CheckValid()
i.Print()
i.SendPackage()
i.LoadImages()
i.Print("SendPackage")
i.KubeadmConfigInstall()
i.Print("SendPackage", "KubeadmConfigInstall")
21 changes: 3 additions & 18 deletions install/send.go
Original file line number Diff line number Diff line change
@@ -3,32 +3,17 @@ package install
import (
"fmt"
"path"
"sync"
)

//SendPackage is
func (s *SealosInstaller) SendPackage() {
//pkg := path.Base(PkgUrl)
//kubeHook := fmt.Sprintf("cd /root && rm -rf kube && tar zxvf %s && cd /root/kube/shell && sh init.sh", pkg)
PkgUrl = SendPackage(PkgUrl, s.Hosts, "/root", nil, nil)
pkg := path.Base(PkgUrl)
kubeHook := fmt.Sprintf("cd /root && rm -rf kube && tar zxvf %s && cd /root/kube/shell && sh init.sh", pkg)
PkgUrl = SendPackage(PkgUrl, s.Hosts, "/root", nil, &kubeHook)

//send sealos
sealos := FetchSealosAbsPath()
beforeHook := "ps -ef |grep -v 'grep'|grep sealos >/dev/null || rm -rf /usr/bin/sealos"
afterHook := "chmod a+x /usr/bin/sealos"
SendPackage(sealos, s.Hosts, "/usr/bin", &beforeHook, &afterHook)
}

func (s *SealosInstaller)LoadImages() {
pkg := path.Base(PkgUrl)
cmd := fmt.Sprintf("cd /root && rm -rf kube && tar zxvf %s && cd /root/kube/shell && sh init.sh", pkg)
var w sync.WaitGroup
for _,host := range s.Hosts {
w.Add(1)
go func(host string) {
SSHConfig.CmdAsync(host,cmd)
w.Done()
}(host)
}
w.Wait()
}

0 comments on commit 76f1c20

Please sign in to comment.